openhermes 4.1.0 → 4.9.2
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 +9 -0
- package/ETHOS.md +6 -3
- package/LICENSE +21 -21
- package/README.md +120 -79
- package/bootstrap.ts +284 -41
- package/harness/agents/oh-browser.md +97 -0
- package/harness/agents/oh-builder.md +78 -0
- package/harness/agents/oh-facade.md +75 -0
- package/harness/agents/oh-fusion.md +45 -0
- package/harness/agents/oh-gauntlet.md +71 -0
- package/harness/agents/oh-grill.md +71 -0
- package/harness/agents/oh-investigate.md +60 -0
- package/harness/agents/oh-manifest.md +95 -0
- package/harness/agents/oh-plan-review.md +40 -0
- package/harness/agents/oh-planner.md +50 -0
- package/harness/agents/oh-refactor.md +37 -0
- package/harness/agents/oh-retro.md +46 -0
- package/harness/agents/oh-review.md +85 -0
- package/harness/agents/oh-security.md +83 -0
- package/harness/agents/oh-ship.md +76 -0
- package/harness/agents/oh-skill-craft.md +38 -0
- package/harness/agents/openhermes.md +106 -62
- package/harness/codex/AUTOPILOT.md +178 -0
- package/harness/codex/CHARTER.md +81 -0
- package/harness/commands/oh-doctor.md +193 -14
- package/harness/commands/oh-log.md +18 -0
- package/harness/instructions/SHELL.md +76 -0
- package/harness/skills/oh-ascii/DEEP.md +292 -0
- package/harness/skills/oh-ascii/SKILL.md +31 -0
- package/harness/skills/oh-ascii/scripts/check_ascii_alignment.py +596 -0
- package/harness/skills/oh-browser/DEEP.md +54 -0
- package/harness/skills/oh-browser/SKILL.md +30 -0
- package/harness/skills/oh-builder/DEEP.md +63 -0
- package/harness/skills/oh-builder/SKILL.md +16 -89
- package/harness/skills/oh-expert/DEEP.md +85 -0
- package/harness/skills/oh-expert/SKILL.md +19 -106
- package/harness/skills/oh-facade/DEEP.md +182 -0
- package/harness/skills/oh-facade/SKILL.md +34 -0
- package/harness/skills/oh-freeze/DEEP.md +18 -0
- package/harness/skills/oh-freeze/SKILL.md +15 -15
- package/harness/skills/oh-full-output/DEEP.md +25 -0
- package/harness/skills/oh-full-output/SKILL.md +28 -0
- package/harness/skills/oh-fusion/DEEP.md +120 -0
- package/harness/skills/oh-fusion/SKILL.md +36 -0
- package/harness/skills/oh-gauntlet/DEEP.md +77 -0
- package/harness/skills/oh-gauntlet/SKILL.md +17 -105
- package/harness/skills/oh-grill/DEEP.md +51 -0
- package/harness/skills/oh-grill/SKILL.md +16 -63
- package/harness/skills/oh-guard/DEEP.md +19 -0
- package/harness/skills/oh-guard/SKILL.md +15 -20
- package/harness/skills/oh-handoff/DEEP.md +48 -0
- package/harness/skills/oh-handoff/SKILL.md +18 -19
- package/harness/skills/oh-health/DEEP.md +74 -0
- package/harness/skills/oh-health/SKILL.md +17 -76
- package/harness/skills/oh-init/DEEP.md +85 -0
- package/harness/skills/oh-init/SKILL.md +17 -197
- package/harness/skills/oh-investigate/DEEP.md +171 -0
- package/harness/skills/oh-investigate/SKILL.md +18 -61
- package/harness/skills/oh-issue/DEEP.md +21 -0
- package/harness/skills/oh-issue/SKILL.md +16 -23
- package/harness/skills/oh-learn/DEEP.md +44 -0
- package/harness/skills/oh-learn/SKILL.md +17 -79
- package/harness/skills/oh-manifest/DEEP.md +92 -0
- package/harness/skills/oh-manifest/SKILL.md +15 -107
- package/harness/skills/oh-plan-review/DEEP.md +90 -0
- package/harness/skills/oh-plan-review/SKILL.md +19 -114
- package/harness/skills/oh-planner/DEEP.md +172 -0
- package/harness/skills/oh-planner/SKILL.md +16 -143
- package/harness/skills/oh-prd/DEEP.md +45 -0
- package/harness/skills/oh-prd/SKILL.md +15 -22
- package/harness/skills/oh-refactor/DEEP.md +122 -0
- package/harness/skills/oh-refactor/SKILL.md +33 -0
- package/harness/skills/oh-retro/DEEP.md +26 -0
- package/harness/skills/oh-retro/SKILL.md +17 -20
- package/harness/skills/oh-review/DEEP.md +87 -0
- package/harness/skills/oh-review/SKILL.md +17 -96
- package/harness/skills/oh-security/DEEP.md +83 -0
- package/harness/skills/oh-security/SKILL.md +18 -96
- package/harness/skills/oh-ship/DEEP.md +141 -0
- package/harness/skills/oh-ship/SKILL.md +18 -26
- package/harness/skills/oh-skill-craft/DEEP.md +369 -0
- package/harness/skills/oh-skill-craft/SKILL.md +20 -93
- package/harness/skills/oh-skills-link/DEEP.md +16 -0
- package/harness/skills/oh-skills-link/SKILL.md +15 -16
- package/harness/skills/oh-skills-list/DEEP.md +20 -0
- package/harness/skills/oh-skills-list/SKILL.md +14 -18
- package/harness/skills/oh-triage/DEEP.md +23 -0
- package/harness/skills/oh-triage/SKILL.md +15 -20
- package/harness/skills/oh-worktree/DEEP.md +169 -0
- package/harness/skills/oh-worktree/SKILL.md +32 -0
- package/lib/harness-resolver.ts +10 -12
- package/package.json +9 -4
- package/scripts/count-tokens.mjs +158 -0
- package/scripts/oh-doctor.ps1 +342 -0
- package/harness/codex/CONSTITUTION.md +0 -70
- package/harness/codex/ROUTING.md +0 -127
- package/harness/instructions/RUNTIME.md +0 -55
- package/harness/skills/oh-caveman/SKILL.md +0 -33
- package/lib/logger.ts +0 -69
|
@@ -1,154 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: oh-planner
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use when a feature, architecture, or idea needs structured planning — from brainstorming through formal plan artifact. Produces consumable plan documents."
|
|
4
4
|
tier: 3
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
- "architecture"
|
|
10
|
-
- "design this feature"
|
|
11
|
-
- "brainstorm"
|
|
12
|
-
- "autoplan"
|
|
13
|
-
- "strategy"
|
|
14
|
-
- "scope this"
|
|
5
|
+
route:
|
|
6
|
+
pass: oh-grill
|
|
7
|
+
fail: oh-planner
|
|
8
|
+
blocker: surface
|
|
15
9
|
---
|
|
16
10
|
|
|
17
11
|
# oh-planner
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
ALL-arounder planner: brainstorm, architecture analysis, structured plan, autoplan.
|
|
20
14
|
|
|
21
|
-
##
|
|
15
|
+
## Steps
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
4. **Narrowest wedge** — what's the smallest useful version?
|
|
32
|
-
5. **Observation** — what will you see/hear when it works?
|
|
33
|
-
6. **Future-fit** — does this compound or plateau?
|
|
34
|
-
|
|
35
|
-
Output: structured design doc.
|
|
36
|
-
|
|
37
|
-
### Mode B: Architecture Analysis (existing codebase)
|
|
38
|
-
When the codebase feels messy or you need to understand the surface.
|
|
39
|
-
|
|
40
|
-
1. **Read the domain** — load CONTEXT.md, understand the language
|
|
41
|
-
2. **Map the surface** — identify modules, boundaries, dependencies
|
|
42
|
-
3. **Find deepening opportunities** — duplication, over-coupling, grown-beyond-purpose functions, missing abstractions
|
|
43
|
-
4. **Rank by impact** — effort vs value, dependencies, risk
|
|
44
|
-
|
|
45
|
-
Output: ranked refactoring candidates.
|
|
46
|
-
|
|
47
|
-
### Mode C: Structured Plan (non-trivial feature)
|
|
48
|
-
When requirements exist but need a plan document.
|
|
49
|
-
|
|
50
|
-
1. **Scope challenge** — before reviewing anything, answer:
|
|
51
|
-
- What existing code already partially solves each sub-problem?
|
|
52
|
-
- What is the minimum set of changes that achieves the stated goal?
|
|
53
|
-
- **Complexity check:** 8+ files or 2+ new classes/services in a single phase → smell. Propose splitting or simplifying.
|
|
54
|
-
- **Search check:** for each architectural pattern or infrastructure component the plan introduces, check whether the runtime/framework has a built-in. Search for: `{framework} {pattern} built-in`. Flag custom solutions where built-ins exist.
|
|
55
|
-
- **Completeness check:** with AI-assisted coding, completeness is 10-100x cheaper than with human teams. If the plan shortcuts something to save human hours that only saves minutes with AI, recommend the complete version.
|
|
56
|
-
2. **Strategy review** — challenge premises, identify scope decisions, consider 10x alternatives
|
|
57
|
-
3. **Architecture review** — data flow, component boundaries, API surface, state model
|
|
58
|
-
4. **Edge case analysis** — error states, concurrency, failure modes, security implications
|
|
59
|
-
5. **Dependency mapping** — what blocks what, parallelizable work
|
|
60
|
-
6. **Write plan.md** — structured artifact with phases, deps, verification steps
|
|
61
|
-
|
|
62
|
-
### Mode D: Autoplan (plan exists, needs full review)
|
|
63
|
-
When a plan file exists and needs the full gauntlet. Auto-decides 90% of questions using decision principles. Surfaces only taste decisions at a final approval gate.
|
|
64
|
-
|
|
65
|
-
Runs in order: **Strategy → Architecture → Design → Engineering → DX**
|
|
66
|
-
Each phase must complete before the next begins.
|
|
67
|
-
|
|
68
|
-
## Decision Principles
|
|
69
|
-
|
|
70
|
-
Use these to auto-resolve intermediate questions. Only surface to the user when options are genuinely close (taste decisions):
|
|
71
|
-
|
|
72
|
-
1. **Completeness over cleverness** — Choose the option that covers more cases
|
|
73
|
-
2. **Boil the lake** — Fix the blast radius, not the symptom
|
|
74
|
-
3. **Pragmatic over perfect** — Cleaner option that ships today wins
|
|
75
|
-
4. **DRY but not premature** — Reuse over rebuild, but don't abstract before the third instance
|
|
76
|
-
5. **Explicit over implicit** — Clear code over magic
|
|
77
|
-
6. **Bias toward action** — When in doubt, make progress
|
|
78
|
-
|
|
79
|
-
Never auto-decide: premises (need human judgment) or cases where both the plan and the alternative have strong arguments.
|
|
80
|
-
|
|
81
|
-
## Plan Artifact
|
|
82
|
-
|
|
83
|
-
Output goes in `.opencode/plan.md` (per-project, overwritten each session) with this structure (matching the global AGENTS.md schema).
|
|
84
|
-
|
|
85
|
-
**Then save a copy** to `%USERPROFILE%/.config/opencode/task/<project-name>-plan-<nnn>.md` (global, incrementing, persistent) per AGENTS.md persistent plan rules.
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
# PLAN: <project-name>
|
|
89
|
-
|
|
90
|
-
Plan ID: <project-name>-plan-<nnn>
|
|
91
|
-
Project: <project-name>
|
|
92
|
-
Status: active
|
|
93
|
-
Created: <local-date-time>
|
|
94
|
-
Updated: <local-date-time>
|
|
95
|
-
Project Path: <absolute-project-path>
|
|
96
|
-
Plan Path: .opencode/plan.md
|
|
97
|
-
Objective: <short objective>
|
|
98
|
-
|
|
99
|
-
## Current State
|
|
100
|
-
|
|
101
|
-
<what exists now, what's missing>
|
|
102
|
-
|
|
103
|
-
## Assumptions
|
|
104
|
-
|
|
105
|
-
- <assumption 1>
|
|
106
|
-
- <assumption 2>
|
|
107
|
-
|
|
108
|
-
## Tasks
|
|
109
|
-
|
|
110
|
-
- [ ] Task 1
|
|
111
|
-
- [ ] Subtask 1.1
|
|
112
|
-
|
|
113
|
-
## Active Task
|
|
114
|
-
|
|
115
|
-
<what's being worked on now>
|
|
116
|
-
|
|
117
|
-
## Subagents
|
|
118
|
-
|
|
119
|
-
| Agent | Purpose | Status | Findings |
|
|
120
|
-
|---|---|---|---|
|
|
121
|
-
|
|
122
|
-
## Completed
|
|
123
|
-
|
|
124
|
-
- <what's done>
|
|
125
|
-
|
|
126
|
-
## Blockers
|
|
127
|
-
|
|
128
|
-
- None
|
|
129
|
-
|
|
130
|
-
## Validation
|
|
131
|
-
|
|
132
|
-
- [ ] Static checks
|
|
133
|
-
- [ ] Unit tests
|
|
134
|
-
- [ ] Manual verification
|
|
135
|
-
|
|
136
|
-
## Decisions
|
|
137
|
-
|
|
138
|
-
- <decision> — <rationale>
|
|
139
|
-
|
|
140
|
-
## Notes
|
|
141
|
-
|
|
142
|
-
<anything else>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Anti-patterns
|
|
146
|
-
- Skipping strategy review for complex features (architecture mistakes compound)
|
|
147
|
-
- Plans at wrong granularity — too vague to execute or too detailed to read
|
|
148
|
-
- Re-opening already-decided debates ("what if we rewrite in Rust?")
|
|
149
|
-
- Perfect being the enemy of shipped (progress > polish)
|
|
150
|
-
- Failing to flag taste decisions to the user
|
|
151
|
-
- Big bang rewrites — plan increments, not overhauls
|
|
17
|
+
1. Determine mode — Mode A (brainstorm vague idea), Mode B (architecture analysis), Mode C (structured plan), or Mode D (autoplan).
|
|
18
|
+
2. Clarify scope — ask 6 clarifying questions (who needs this, current workflow, capability gap, smallest version, success signals, compound vs plateau).
|
|
19
|
+
3. Map code surface if applicable — module boundaries, dependencies, find deepening opportunities, rank by effort/value/risk.
|
|
20
|
+
4. Challenge premises — check existing code reuse, minimum changes, complexity (8+ files = smell), framework built-ins, completeness.
|
|
21
|
+
5. Analyze architecture — data flow, component boundaries, API surface, state model, edge cases (error, concurrency, failure, security), dependency mapping.
|
|
22
|
+
6. Write structured plan — canonical format: Current State, Assumptions, Tasks, Active Task, Subagents, Completed, Work Log, Blockers, Validation, Decisions, Notes.
|
|
23
|
+
7. Apply auto-resolution principles — completeness over cleverness, boil the lake, pragmatic over perfect, DRY at 3rd, explicit over implicit, bias toward action. Surface taste decisions.
|
|
24
|
+
8. Self-review — verify spec coverage, scan for placeholders (TBD/TODO), check type consistency across tasks.
|
|
152
25
|
|
|
153
26
|
## Routing
|
|
154
27
|
|
|
@@ -156,4 +29,4 @@ Objective: <short objective>
|
|
|
156
29
|
|---------|-------|
|
|
157
30
|
| pass | → oh-grill (stress-test plan) |
|
|
158
31
|
| fail | → oh-planner (revise gaps) |
|
|
159
|
-
| blocker | → surface
|
|
32
|
+
| blocker | → surface |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# oh-prd — Deep Reference
|
|
2
|
+
|
|
3
|
+
## When to Use
|
|
4
|
+
|
|
5
|
+
Conversation has defined a feature well enough to write requirements. Produces a structured PRD and publishes as a GitHub issue.
|
|
6
|
+
|
|
7
|
+
Triggers: write a prd, product requirements, spec this feature, feature spec.
|
|
8
|
+
|
|
9
|
+
## PRD Structure
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# PRD: <feature name>
|
|
13
|
+
|
|
14
|
+
## Problem Statement
|
|
15
|
+
<what problem does this solve, for whom>
|
|
16
|
+
|
|
17
|
+
## Success Criteria
|
|
18
|
+
<measurable outcomes>
|
|
19
|
+
|
|
20
|
+
## Scope
|
|
21
|
+
### In scope
|
|
22
|
+
- <features included>
|
|
23
|
+
|
|
24
|
+
### Out of scope
|
|
25
|
+
- <explicitly excluded — prevents scope creep>
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
### Functional
|
|
29
|
+
- <numbered behaviors>
|
|
30
|
+
|
|
31
|
+
### Non-functional
|
|
32
|
+
- <performance, security, accessibility, observability>
|
|
33
|
+
|
|
34
|
+
## Open Questions
|
|
35
|
+
- <unresolved items>
|
|
36
|
+
|
|
37
|
+
## Dependencies
|
|
38
|
+
- <what must exist first>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Anti-patterns
|
|
42
|
+
|
|
43
|
+
- Specifying solutions instead of problems (let the builder decide how)
|
|
44
|
+
- Too detailed (PRD sets direction, not implementation)
|
|
45
|
+
- No open questions section (there are always open questions)
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: oh-prd
|
|
3
|
-
description: "
|
|
3
|
+
description: "Write structured PRDs from conversation context and publish as issues"
|
|
4
|
+
tier: 2
|
|
5
|
+
route:
|
|
6
|
+
pass: oh-issue
|
|
7
|
+
fail: oh-grill
|
|
8
|
+
blocker: surface
|
|
4
9
|
---
|
|
5
10
|
|
|
6
11
|
# oh-prd
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
When a feature discussion has produced enough context to write a product requirements document. Captures the decision tree and outputs a structured issue.
|
|
13
|
+
Turn conversation context into a structured PRD and publish as a GitHub issue.
|
|
10
14
|
|
|
11
|
-
##
|
|
12
|
-
1. Extract requirements from conversation history
|
|
13
|
-
2. Structure into PRD format: problem statement, target users, requirements (must/should/could), out of scope
|
|
14
|
-
3. Create as GitHub issue with `gh issue create`
|
|
15
|
-
4. Add triage label for prioritisation
|
|
15
|
+
## Steps
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **Out of scope** — explicitly what's NOT included
|
|
22
|
-
- **Success metrics** — how will we know it works?
|
|
23
|
-
|
|
24
|
-
## Anti-patterns
|
|
25
|
-
- Writing PRD before understanding the problem
|
|
26
|
-
- Requirements that aren't testable ("fast" vs "loads in <200ms")
|
|
27
|
-
- Gold-plating — every feature is "must have"
|
|
17
|
+
1. Extract requirements from conversation context
|
|
18
|
+
2. Structure into formal PRD format
|
|
19
|
+
3. Surface open questions to user
|
|
20
|
+
4. Publish as GitHub issue via `gh issue create`
|
|
28
21
|
|
|
29
22
|
## Routing
|
|
30
23
|
|
|
31
24
|
| Outcome | Route |
|
|
32
25
|
|---------|-------|
|
|
33
|
-
| pass | → oh-issue
|
|
34
|
-
| fail | → oh-grill
|
|
35
|
-
| blocker | → surface
|
|
26
|
+
| pass | → oh-issue |
|
|
27
|
+
| fail | → oh-grill |
|
|
28
|
+
| blocker | → surface |
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# oh-refactor — Deep Reference
|
|
2
|
+
|
|
3
|
+
## Golden Rules
|
|
4
|
+
|
|
5
|
+
1. **Behavior preserved** — changes structure only. Changing behavior = feature, not refactor.
|
|
6
|
+
2. **Small steps** — one change, verify, commit, repeat. Never batch.
|
|
7
|
+
3. **Tests essential** — no safety net = editing blind. Write characterization tests first.
|
|
8
|
+
4. **One thing per commit** — never mix refactoring with feature work.
|
|
9
|
+
5. **Commit between safe states** — commit before starting, after each green run.
|
|
10
|
+
|
|
11
|
+
## When NOT to Refactor
|
|
12
|
+
- Code that works and will never change
|
|
13
|
+
- Critical production code without tests (add tests first)
|
|
14
|
+
- Tight deadline with no test safety net
|
|
15
|
+
- "Just because" — every refactor needs a clear purpose
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
### Phase 1: Prepare
|
|
20
|
+
Check test coverage (thin → write characterization tests). Commit current state. Create feature branch.
|
|
21
|
+
|
|
22
|
+
### Phase 2: Identify
|
|
23
|
+
Find code smell. Understand what code does. Plan smallest fix. If behavior unclear → delegate to oh-investigate.
|
|
24
|
+
|
|
25
|
+
### Phase 3: Refactor (small steps)
|
|
26
|
+
One change → run tests → commit → repeat until smell is gone.
|
|
27
|
+
|
|
28
|
+
### Phase 4: Verify
|
|
29
|
+
All tests pass. Manual smoke test if coverage missing. Performance unchanged or better. Diff shows structural changes only.
|
|
30
|
+
|
|
31
|
+
### Phase 5: Clean Up
|
|
32
|
+
Remove commented-out code, stale imports, dead paths. Update docs only if semantics changed. Final commit.
|
|
33
|
+
|
|
34
|
+
## Common Code Smells & Fixes (top 6)
|
|
35
|
+
|
|
36
|
+
### 1. Long Method
|
|
37
|
+
```diff
|
|
38
|
+
- async function processOrder(orderId) {
|
|
39
|
+
- // 50 lines: fetch // 30 lines: validate
|
|
40
|
+
- // 40 lines: pricing // 30 lines: inventory
|
|
41
|
+
- // 20 lines: shipment // 30 lines: notifications
|
|
42
|
+
- }
|
|
43
|
+
+ async function processOrder(orderId) {
|
|
44
|
+
+ const order = await fetchOrder(orderId);
|
|
45
|
+
+ validateOrder(order);
|
|
46
|
+
+ const pricing = calculatePricing(order);
|
|
47
|
+
+ const shipment = await createShipment(order);
|
|
48
|
+
+ await sendNotifications(order, pricing, shipment);
|
|
49
|
+
+ return { order, pricing, shipment };
|
|
50
|
+
+ }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. Guard Clauses (Arrow Code)
|
|
54
|
+
```diff
|
|
55
|
+
- if (order) { if (order.user) { if (order.total > 0) { return processOrder(order); }}}
|
|
56
|
+
+ if (!order) return { error: 'No order' };
|
|
57
|
+
+ if (!order.user) return { error: 'No user' };
|
|
58
|
+
+ if (order.total <= 0) return { error: 'Invalid total' };
|
|
59
|
+
+ return processOrder(order);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Duplicated Code
|
|
63
|
+
```diff
|
|
64
|
+
- function calculateUserDiscount(user) { if (user.membership === 'gold') return user.total * 0.2; }
|
|
65
|
+
- function calculateOrderDiscount(order) { if (order.user.membership === 'gold') return order.total * 0.2; }
|
|
66
|
+
+ function getDiscountRate(membership) { return { gold: 0.2, silver: 0.1 }[membership] || 0; }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 4. Magic Numbers → Constants
|
|
70
|
+
```diff
|
|
71
|
+
- if (user.status === 2) { }
|
|
72
|
+
- const discount = total * 0.15;
|
|
73
|
+
+ const UserStatus = { ACTIVE: 1, INACTIVE: 2 } as const;
|
|
74
|
+
+ const DISCOUNT_RATES = { PREMIUM: 0.15, VIP: 0.2 } as const;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 5. Primitive Obsession
|
|
78
|
+
```diff
|
|
79
|
+
- function sendEmail(to, subject, body) { }
|
|
80
|
+
- sendEmail('user@example.com', 'Hello', '...');
|
|
81
|
+
+ class Email {
|
|
82
|
+
+ private constructor(public readonly value: string) {
|
|
83
|
+
+ if (!Email.isValid(value)) throw new Error('Invalid email');
|
|
84
|
+
+ }
|
|
85
|
+
+ static create(v: string) { return new Email(v); }
|
|
86
|
+
+ static isValid(e: string) { return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e); }
|
|
87
|
+
+ }
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 6. Feature Envy
|
|
91
|
+
```diff
|
|
92
|
+
- class Order { calculateDiscount(user) { if (user.membershipLevel === 'gold') return this.total * 0.2; } }
|
|
93
|
+
+ class User { getDiscountRate(orderTotal) { const rates = { gold: 0.2, silver: 0.1 }; return rates[this.membershipLevel] || 0; } }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Common Operations Reference
|
|
97
|
+
|
|
98
|
+
| Operation | What it does |
|
|
99
|
+
|-----------|-------------|
|
|
100
|
+
| Extract Method | Turn fragment into named function |
|
|
101
|
+
| Extract Class | Move related behavior to new class |
|
|
102
|
+
| Rename Method/Variable | Improve clarity |
|
|
103
|
+
| Introduce Parameter Object | Group related params |
|
|
104
|
+
| Guard Clauses | Early returns flatten nesting |
|
|
105
|
+
| Replace Magic Number | Named constants for literals |
|
|
106
|
+
| Consolidate Conditional | Combine duplicate conditions |
|
|
107
|
+
|
|
108
|
+
## Checklist
|
|
109
|
+
|
|
110
|
+
- [ ] Functions small (< 50 lines), single-purpose
|
|
111
|
+
- [ ] No duplicated code
|
|
112
|
+
- [ ] Descriptive names, no magic values
|
|
113
|
+
- [ ] No dead code, stale imports, commented-out code
|
|
114
|
+
- [ ] Clear module boundaries, no circular deps
|
|
115
|
+
- [ ] Types for all public APIs, no `any` without justification
|
|
116
|
+
- [ ] All tests pass, edge cases covered
|
|
117
|
+
|
|
118
|
+
## Anti-patterns
|
|
119
|
+
- Refactoring without tests (behavior preservation is unverifiable)
|
|
120
|
+
- Mixing behavior changes with refactoring
|
|
121
|
+
- "While I'm here" scope creep
|
|
122
|
+
- Large batch refactors (commit between safe states)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oh-refactor
|
|
3
|
+
description: "Use when code is hard to maintain, functions are too long, code smells accumulate, or the user asks to clean up, improve, or refactor code. Behavior-preserving refactoring — extract, deduplicate, simplify, improve types."
|
|
4
|
+
tier: 3
|
|
5
|
+
route:
|
|
6
|
+
pass: oh-gauntlet
|
|
7
|
+
fail:
|
|
8
|
+
- oh-planner
|
|
9
|
+
- oh-investigate
|
|
10
|
+
- oh-builder
|
|
11
|
+
blocker: surface
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# oh-refactor
|
|
15
|
+
|
|
16
|
+
Improve code structure without changing external behavior.
|
|
17
|
+
|
|
18
|
+
## Steps
|
|
19
|
+
|
|
20
|
+
1. Prepare — check test coverage. Write characterization tests if thin. Commit current state. Create feature branch.
|
|
21
|
+
2. Identify — find code smell. Understand what the code does. Plan the smallest fix.
|
|
22
|
+
3. Refactor in small steps — one change, run tests, commit. Repeat until smell is gone.
|
|
23
|
+
4. Verify — all tests pass, manual smoke test if coverage missing, performance unchanged, diff shows structural changes only.
|
|
24
|
+
5. Clean up — remove commented-out code, stale imports, dead paths. Update docs only if semantics changed.
|
|
25
|
+
|
|
26
|
+
## Routing
|
|
27
|
+
|
|
28
|
+
| Outcome | Route |
|
|
29
|
+
|---------|-------|
|
|
30
|
+
| pass | → oh-gauntlet (test integrity) |
|
|
31
|
+
| behavior unclear | → oh-investigate |
|
|
32
|
+
| test gap found | → oh-builder (TDD mode) |
|
|
33
|
+
| blocker | → surface |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# oh-retro — Deep Reference
|
|
2
|
+
|
|
3
|
+
## When to Use
|
|
4
|
+
|
|
5
|
+
End of sprint or work week. Analyze shipped work, how it went, what to improve.
|
|
6
|
+
|
|
7
|
+
## Workflow
|
|
8
|
+
|
|
9
|
+
1. Read git log since last retro
|
|
10
|
+
2. Categorize: features, fixes, refactors, docs, chores
|
|
11
|
+
3. Pattern analysis: recurring themes, bottlenecks, bug types
|
|
12
|
+
4. Praise: good work, patterns, decisions
|
|
13
|
+
5. Growth areas: specific suggestions for improvement
|
|
14
|
+
6. Trend tracking: compare to previous retros
|
|
15
|
+
|
|
16
|
+
## Output
|
|
17
|
+
|
|
18
|
+
Structured retro: shipped items, metrics, praise, growth areas, action items.
|
|
19
|
+
|
|
20
|
+
**Example:** End of sprint. Read git log → categorize (features, fixes, refactors) → pattern analysis → praise → growth areas → action items.
|
|
21
|
+
|
|
22
|
+
## Anti-patterns
|
|
23
|
+
|
|
24
|
+
- Blame-focused (process, not people)
|
|
25
|
+
- Action items without owners
|
|
26
|
+
- Same retro every week (nothing changed → why?)
|
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: oh-retro
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use at the end of a sprint or milestone to analyze commit history, work patterns, and extract actionable insights for the next cycle."
|
|
4
|
+
tier: 3
|
|
5
|
+
route:
|
|
6
|
+
pass: oh-planner
|
|
7
|
+
fail: oh-handoff
|
|
8
|
+
blocker: surface
|
|
4
9
|
---
|
|
5
10
|
|
|
6
11
|
# oh-retro
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
At the end of a sprint or work week. Analyzes what was shipped, how it went, and what to improve.
|
|
13
|
+
Analyze shipped work and extract actionable insights for the next cycle.
|
|
10
14
|
|
|
11
|
-
##
|
|
12
|
-
1. **Analyze commits** — read git log since last retro
|
|
13
|
-
2. **Categorize work** — features, fixes, refactors, docs, chores
|
|
14
|
-
3. **Pattern analysis** — recurring themes, bottlenecks, types of bugs
|
|
15
|
-
4. **Praise** — call out good work, good patterns, good decisions
|
|
16
|
-
5. **Growth areas** — what could be better, with specific suggestions
|
|
17
|
-
6. **Trend tracking** — compare against previous retros
|
|
15
|
+
## Steps
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- Same retro every week (if nothing changed, why?)
|
|
17
|
+
1. Read git log since last retro
|
|
18
|
+
2. Categorize commits: features, fixes, refactors, docs, chores
|
|
19
|
+
3. Analyze recurring themes, bottlenecks, and bug types
|
|
20
|
+
4. Document praise: good work, patterns, decisions
|
|
21
|
+
5. Identify growth areas with specific improvement suggestions
|
|
22
|
+
6. Track trends against previous retros
|
|
26
23
|
|
|
27
24
|
## Routing
|
|
28
25
|
|
|
29
26
|
| Outcome | Route |
|
|
30
27
|
|---------|-------|
|
|
31
|
-
| pass | → oh-planner
|
|
32
|
-
| fail | → oh-handoff
|
|
33
|
-
| blocker | → surface
|
|
28
|
+
| pass | → oh-planner |
|
|
29
|
+
| fail | → oh-handoff |
|
|
30
|
+
| blocker | → surface |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# oh-review — Deep Reference
|
|
2
|
+
|
|
3
|
+
## Mode A: Diff Review
|
|
4
|
+
|
|
5
|
+
### 1. Pin Fixed Point
|
|
6
|
+
User provides branch/commit/tag. Capture `git diff <fixed>...HEAD` + `git log <fixed>..HEAD --oneline`.
|
|
7
|
+
|
|
8
|
+
### 2. Find Spec Source (order)
|
|
9
|
+
1. Issue refs in commit messages (`#123`, `Closes #45`)
|
|
10
|
+
2. User-provided path
|
|
11
|
+
3. `docs/`, `specs/`, `.scratch/` files
|
|
12
|
+
4. Ask user
|
|
13
|
+
|
|
14
|
+
No spec found → spec sub-agent reports "no spec available."
|
|
15
|
+
|
|
16
|
+
### 3. Find Standards Sources
|
|
17
|
+
AGENTS.md, CLAUDE.md, CONTRIBUTING.md, CONTEXT.md, ADRs, eslint/biome/prettier config (note tool-enforced — don't re-check).
|
|
18
|
+
|
|
19
|
+
### 4. Spawn Sub-Agents (parallel)
|
|
20
|
+
- **Standards** — Read standards + diff. Per-file/hunk: violations citing standard + rule. Distinguish hard violations from judgment calls. Skip tool-enforced.
|
|
21
|
+
- **Spec** — Read spec + diff. Report: missing/partial requirements, scope creep, wrong implementations. Quote spec line.
|
|
22
|
+
|
|
23
|
+
### 5. Aggregate
|
|
24
|
+
Present under `## Standards` / `## Spec`. Do not merge. End with total + worst issue.
|
|
25
|
+
|
|
26
|
+
### Safety Check (inline before spawning)
|
|
27
|
+
- SQL injection, LLM trust boundary violations, conditional side effects (test vs prod), hardcoded secrets
|
|
28
|
+
- Block immediately if critical — do not spawn sub-agents.
|
|
29
|
+
|
|
30
|
+
## Mode B: Architecture Deepening
|
|
31
|
+
|
|
32
|
+
Surface refactoring opportunities using the **deletion test**: deleting a shallow module concentrates complexity; a deep module's complexity vanishes.
|
|
33
|
+
|
|
34
|
+
### Vocabulary
|
|
35
|
+
- **Module** — interface + implementation
|
|
36
|
+
- **Depth** — leverage at interface (lots of behavior, small interface)
|
|
37
|
+
- **Seam** — where interface lives; place to alter behavior without in-place edit
|
|
38
|
+
- **Leverage** — what callers get from depth
|
|
39
|
+
- **Locality** — change concentrated in one place
|
|
40
|
+
|
|
41
|
+
### Process
|
|
42
|
+
1. **Explore** — Read CONTEXT.md, ADRs. Walk codebase for friction (bouncing between modules, shallow interfaces, deletion test candidates).
|
|
43
|
+
2. **Present candidates** — Numbered. Files, problem, solution, locality/leverage benefits. Flag ADR conflicts.
|
|
44
|
+
3. **Grilling loop** — Walk design tree. Update CONTEXT.md for new terms. Offer ADRs for rejected candidates.
|
|
45
|
+
4. **Output** — Ranked refactoring candidates with collision warnings.
|
|
46
|
+
|
|
47
|
+
## Mode C: Receiving Review Feedback
|
|
48
|
+
|
|
49
|
+
**Pattern:** READ → UNDERSTAND → VERIFY → EVALUATE → RESPOND → IMPLEMENT
|
|
50
|
+
|
|
51
|
+
### Banned Responses
|
|
52
|
+
Never: "You're absolutely right!", "Great point!", "Excellent feedback!", any gratitude. Instead: restate technical requirement, ask clarifying questions, or just implement.
|
|
53
|
+
|
|
54
|
+
### Source-Specific Handling
|
|
55
|
+
- **Partner (trusted):** Still verify. No performative agreement. Skip to action or technical acknowledgment.
|
|
56
|
+
- **External reviewer (skeptical):** Check 5 things before implementing — technically correct? Breaks existing? Full context? Cross-platform? Conflicts with prior decisions?
|
|
57
|
+
|
|
58
|
+
### YAGNI Check
|
|
59
|
+
If reviewer says "implement properly", grep for actual usage. Unused → propose removal. Used → implement.
|
|
60
|
+
|
|
61
|
+
### Implementation Order
|
|
62
|
+
1. Clarify unclear items FIRST (partial understanding = wrong implementation)
|
|
63
|
+
2. Blocker fixes (breaks, security)
|
|
64
|
+
3. Simple fixes (typos, imports)
|
|
65
|
+
4. Complex fixes (refactoring, logic)
|
|
66
|
+
5. Test each individually, verify no regressions
|
|
67
|
+
|
|
68
|
+
### When to Push Back
|
|
69
|
+
Suggestion breaks existing functionality, reviewer lacks context, violates YAGNI, technically incorrect for this stack, conflicts with architecture decisions. Use technical reasoning, not defensiveness.
|
|
70
|
+
|
|
71
|
+
### Graceful Correction
|
|
72
|
+
If you pushed back and were wrong: state factually — "You were right, checked [X], it does [Y]. Fixing now." No long apologies, no defending, no over-explaining.
|
|
73
|
+
|
|
74
|
+
## Scoring
|
|
75
|
+
- Critical safety → block before sub-agents
|
|
76
|
+
- Structural concern / spec deviation → changes requested
|
|
77
|
+
- Style/nit → follow-up note
|
|
78
|
+
|
|
79
|
+
## Anti-patterns
|
|
80
|
+
- Style before safety
|
|
81
|
+
- Rubber-stamping without reading diff
|
|
82
|
+
- Subjective preference changes
|
|
83
|
+
- Merging Standards + Spec findings (one axis masks the other)
|
|
84
|
+
- Proposing interfaces before user picks a candidate
|
|
85
|
+
- Performative agreement (thanking reviewer before verifying)
|
|
86
|
+
- Blind implementation of reviewer suggestions
|
|
87
|
+
- Mixing feedback handling modes
|