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.
Files changed (99) hide show
  1. package/CONTEXT.md +9 -0
  2. package/ETHOS.md +6 -3
  3. package/LICENSE +21 -21
  4. package/README.md +120 -79
  5. package/bootstrap.ts +284 -41
  6. package/harness/agents/oh-browser.md +97 -0
  7. package/harness/agents/oh-builder.md +78 -0
  8. package/harness/agents/oh-facade.md +75 -0
  9. package/harness/agents/oh-fusion.md +45 -0
  10. package/harness/agents/oh-gauntlet.md +71 -0
  11. package/harness/agents/oh-grill.md +71 -0
  12. package/harness/agents/oh-investigate.md +60 -0
  13. package/harness/agents/oh-manifest.md +95 -0
  14. package/harness/agents/oh-plan-review.md +40 -0
  15. package/harness/agents/oh-planner.md +50 -0
  16. package/harness/agents/oh-refactor.md +37 -0
  17. package/harness/agents/oh-retro.md +46 -0
  18. package/harness/agents/oh-review.md +85 -0
  19. package/harness/agents/oh-security.md +83 -0
  20. package/harness/agents/oh-ship.md +76 -0
  21. package/harness/agents/oh-skill-craft.md +38 -0
  22. package/harness/agents/openhermes.md +106 -62
  23. package/harness/codex/AUTOPILOT.md +178 -0
  24. package/harness/codex/CHARTER.md +81 -0
  25. package/harness/commands/oh-doctor.md +193 -14
  26. package/harness/commands/oh-log.md +18 -0
  27. package/harness/instructions/SHELL.md +76 -0
  28. package/harness/skills/oh-ascii/DEEP.md +292 -0
  29. package/harness/skills/oh-ascii/SKILL.md +31 -0
  30. package/harness/skills/oh-ascii/scripts/check_ascii_alignment.py +596 -0
  31. package/harness/skills/oh-browser/DEEP.md +54 -0
  32. package/harness/skills/oh-browser/SKILL.md +30 -0
  33. package/harness/skills/oh-builder/DEEP.md +63 -0
  34. package/harness/skills/oh-builder/SKILL.md +16 -89
  35. package/harness/skills/oh-expert/DEEP.md +85 -0
  36. package/harness/skills/oh-expert/SKILL.md +19 -106
  37. package/harness/skills/oh-facade/DEEP.md +182 -0
  38. package/harness/skills/oh-facade/SKILL.md +34 -0
  39. package/harness/skills/oh-freeze/DEEP.md +18 -0
  40. package/harness/skills/oh-freeze/SKILL.md +15 -15
  41. package/harness/skills/oh-full-output/DEEP.md +25 -0
  42. package/harness/skills/oh-full-output/SKILL.md +28 -0
  43. package/harness/skills/oh-fusion/DEEP.md +120 -0
  44. package/harness/skills/oh-fusion/SKILL.md +36 -0
  45. package/harness/skills/oh-gauntlet/DEEP.md +77 -0
  46. package/harness/skills/oh-gauntlet/SKILL.md +17 -105
  47. package/harness/skills/oh-grill/DEEP.md +51 -0
  48. package/harness/skills/oh-grill/SKILL.md +16 -63
  49. package/harness/skills/oh-guard/DEEP.md +19 -0
  50. package/harness/skills/oh-guard/SKILL.md +15 -20
  51. package/harness/skills/oh-handoff/DEEP.md +48 -0
  52. package/harness/skills/oh-handoff/SKILL.md +18 -19
  53. package/harness/skills/oh-health/DEEP.md +74 -0
  54. package/harness/skills/oh-health/SKILL.md +17 -76
  55. package/harness/skills/oh-init/DEEP.md +85 -0
  56. package/harness/skills/oh-init/SKILL.md +17 -197
  57. package/harness/skills/oh-investigate/DEEP.md +171 -0
  58. package/harness/skills/oh-investigate/SKILL.md +18 -61
  59. package/harness/skills/oh-issue/DEEP.md +21 -0
  60. package/harness/skills/oh-issue/SKILL.md +16 -23
  61. package/harness/skills/oh-learn/DEEP.md +44 -0
  62. package/harness/skills/oh-learn/SKILL.md +17 -79
  63. package/harness/skills/oh-manifest/DEEP.md +92 -0
  64. package/harness/skills/oh-manifest/SKILL.md +15 -107
  65. package/harness/skills/oh-plan-review/DEEP.md +90 -0
  66. package/harness/skills/oh-plan-review/SKILL.md +19 -114
  67. package/harness/skills/oh-planner/DEEP.md +172 -0
  68. package/harness/skills/oh-planner/SKILL.md +16 -143
  69. package/harness/skills/oh-prd/DEEP.md +45 -0
  70. package/harness/skills/oh-prd/SKILL.md +15 -22
  71. package/harness/skills/oh-refactor/DEEP.md +122 -0
  72. package/harness/skills/oh-refactor/SKILL.md +33 -0
  73. package/harness/skills/oh-retro/DEEP.md +26 -0
  74. package/harness/skills/oh-retro/SKILL.md +17 -20
  75. package/harness/skills/oh-review/DEEP.md +87 -0
  76. package/harness/skills/oh-review/SKILL.md +17 -96
  77. package/harness/skills/oh-security/DEEP.md +83 -0
  78. package/harness/skills/oh-security/SKILL.md +18 -96
  79. package/harness/skills/oh-ship/DEEP.md +141 -0
  80. package/harness/skills/oh-ship/SKILL.md +18 -26
  81. package/harness/skills/oh-skill-craft/DEEP.md +369 -0
  82. package/harness/skills/oh-skill-craft/SKILL.md +20 -93
  83. package/harness/skills/oh-skills-link/DEEP.md +16 -0
  84. package/harness/skills/oh-skills-link/SKILL.md +15 -16
  85. package/harness/skills/oh-skills-list/DEEP.md +20 -0
  86. package/harness/skills/oh-skills-list/SKILL.md +14 -18
  87. package/harness/skills/oh-triage/DEEP.md +23 -0
  88. package/harness/skills/oh-triage/SKILL.md +15 -20
  89. package/harness/skills/oh-worktree/DEEP.md +169 -0
  90. package/harness/skills/oh-worktree/SKILL.md +32 -0
  91. package/lib/harness-resolver.ts +10 -12
  92. package/package.json +9 -4
  93. package/scripts/count-tokens.mjs +158 -0
  94. package/scripts/oh-doctor.ps1 +342 -0
  95. package/harness/codex/CONSTITUTION.md +0 -70
  96. package/harness/codex/ROUTING.md +0 -127
  97. package/harness/instructions/RUNTIME.md +0 -55
  98. package/harness/skills/oh-caveman/SKILL.md +0 -33
  99. package/lib/logger.ts +0 -69
@@ -0,0 +1,342 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Quick-win diagnostic for openhermes-pkg — AI-orchestrator-facing.
4
+ .DESCRIPTION
5
+ Outputs JSON-Lines diagnostics consumable by the OpenHermes orchestrator.
6
+ Each line is a check result; final line is the summary verdict.
7
+ .PARAMETER SkipOCChecks
8
+ Skip opencode CLI checks (useful when opencode isn't running).
9
+ .EXAMPLE
10
+ .\oh-doctor.ps1
11
+ .\oh-doctor.ps1 -SkipOCChecks
12
+ #>
13
+
14
+ param(
15
+ [switch]$SkipOCChecks
16
+ )
17
+
18
+ $PackageRoot = Resolve-Path "$PSScriptRoot\.."
19
+ $ErrorActionPreference = "Continue"
20
+ $script:checks = @()
21
+ $script:checks = @()
22
+
23
+ function Write-Check {
24
+ param(
25
+ [Parameter(Mandatory)] [string]$Id,
26
+ [Parameter(Mandatory)] [string]$Name,
27
+ [Parameter(Mandatory)] [ValidateSet("PASS","WARN","FAIL","SKIP")] [string]$Status,
28
+ [string]$Detail = "",
29
+ [hashtable]$Evidence = @{},
30
+ [string]$Severity = "medium",
31
+ [hashtable]$Fix = @{}
32
+ )
33
+ $result = @{
34
+ id = $Id
35
+ name = $Name
36
+ status = $Status
37
+ severity = $Severity
38
+ detail = $Detail
39
+ evidence = $Evidence
40
+ fix = $Fix
41
+ }
42
+ $script:checks += $result
43
+ $result | ConvertTo-Json -Compress -Depth 5
44
+ }
45
+
46
+ # ============================================================
47
+ # CHECK 1: AGENTS.md accuracy
48
+ # ============================================================
49
+ $agentPath = Join-Path $PackageRoot "AGENTS.md"
50
+ if (Test-Path $agentPath) {
51
+ $agentContent = Get-Content $agentPath -Raw
52
+ $skillDir = Join-Path (Join-Path $PackageRoot "harness") "skills"
53
+ $actualCount = (Get-ChildItem $skillDir -Directory).Count
54
+
55
+ # Skill count check
56
+ if ($agentContent -match '## Skills \((\d+)\)') {
57
+ $claimedCount = [int]$Matches[1]
58
+ if ($claimedCount -eq $actualCount) {
59
+ Write-Check -Id "agentsmd.skill_count" -Name "AGENTS.md skill count" -Status PASS `
60
+ -Detail "Claims $claimedCount, filesystem has $actualCount" `
61
+ -Evidence @{ file = $agentPath; claimed = $claimedCount; actual = $actualCount }
62
+ } else {
63
+ Write-Check -Id "agentsmd.skill_count" -Name "AGENTS.md skill count" -Status FAIL `
64
+ -Severity high -Detail "Claims $claimedCount but filesystem has $actualCount" `
65
+ -Evidence @{ file = $agentPath; claimed = $claimedCount; actual = $actualCount } `
66
+ -Fix @{ auto = $true; command = "Update AGENTS.md header from ${claimedCount} skills to ${actualCount} skills" }
67
+ }
68
+ } else {
69
+ Write-Check -Id "agentsmd.skill_count" -Name "AGENTS.md skill count" -Status WARN `
70
+ -Detail "Could not parse skill count from AGENTS.md" `
71
+ -Evidence @{ file = $agentPath }
72
+ }
73
+
74
+ # logger.ts reference
75
+ $libDir = Join-Path $PackageRoot "lib"
76
+ $libFiles = Get-ChildItem $libDir -File | ForEach-Object { $_.Name }
77
+ if ($agentContent -match "logger\.ts") {
78
+ if ($libFiles -contains "logger.ts") {
79
+ Write-Check -Id "agentsmd.logger_ref" -Name "AGENTS.md logger.ts reference" -Status PASS `
80
+ -Detail "logger.ts exists in lib/" `
81
+ -Evidence @{ file = $agentPath }
82
+ } else {
83
+ $actualList = $libFiles -join ","
84
+ Write-Check -Id "agentsmd.logger_ref" -Name "AGENTS.md logger.ts reference" -Status FAIL `
85
+ -Severity high -Detail "Claims logger.ts but file does not exist" `
86
+ -Evidence @{ file = $agentPath; claimed = "logger.ts"; onDisk = $actualList } `
87
+ -Fix @{ auto = $true; command = "Remove 'logger.ts' from AGENTS.md" }
88
+ }
89
+ }
90
+
91
+ # SHELL.md reference
92
+ $instDir = Join-Path (Join-Path $PackageRoot "harness") "instructions"
93
+ $hasShell = Test-Path (Join-Path $instDir "SHELL.md")
94
+ if ($agentContent -match "SHELL\.md") {
95
+ if ($hasShell) {
96
+ Write-Check -Id "agentsmd.shell_ref" -Name "AGENTS.md SHELL.md reference" -Status PASS `
97
+ -Detail "SHELL.md referenced and exists on disk" `
98
+ -Evidence @{ file = $agentPath; referenced = "SHELL.md" }
99
+ } else {
100
+ Write-Check -Id "agentsmd.shell_ref" -Name "AGENTS.md SHELL.md reference" -Status WARN `
101
+ -Severity medium -Detail "SHELL.md referenced but missing from disk" `
102
+ -Evidence @{ file = $agentPath; referenced = "SHELL.md" }
103
+ }
104
+ } elseif ($hasShell) {
105
+ Write-Check -Id "agentsmd.shell_ref" -Name "AGENTS.md SHELL.md reference" -Status WARN `
106
+ -Severity low -Detail "SHELL.md exists on disk but AGENTS.md does not mention it" `
107
+ -Evidence @{ file = $agentPath; onDisk = "harness/instructions/SHELL.md" }
108
+ }
109
+ } else {
110
+ Write-Check -Id "agentsmd.exists" -Name "AGENTS.md exists" -Status FAIL -Severity high `
111
+ -Detail "File not found at ${agentPath}" `
112
+ -Evidence @{ path = $agentPath }
113
+ }
114
+
115
+ # ============================================================
116
+ # CHECK 2: package.json files integrity
117
+ # ============================================================
118
+ $pkgPath = Join-Path $PackageRoot "package.json"
119
+ if (Test-Path $pkgPath) {
120
+ $pkg = Get-Content $pkgPath -Raw | ConvertFrom-Json
121
+ $missing = @()
122
+ $found = @()
123
+ foreach ($entry in $pkg.files) {
124
+ $resolved = Join-Path $PackageRoot $entry
125
+ if (Test-Path $resolved) { $found += $entry }
126
+ else { $missing += $entry }
127
+ }
128
+ if ($missing.Count -eq 0) {
129
+ Write-Check -Id "pkg.files_integrity" -Name "package.json files field" -Status PASS `
130
+ -Detail "All $($pkg.files.Count) entries exist on disk" `
131
+ -Evidence @{ file = $pkgPath; entries = @($pkg.files) }
132
+ } else {
133
+ Write-Check -Id "pkg.files_integrity" -Name "package.json files field" -Status FAIL `
134
+ -Severity high -Detail "$($missing.Count) entry(s) missing: $($missing -join ',')" `
135
+ -Evidence @{ file = $pkgPath; missing = $missing } `
136
+ -Fix @{ auto = $false; command = "Create or remove from files: $($missing -join ',')" }
137
+ }
138
+ } else {
139
+ Write-Check -Id "pkg.exists" -Name "package.json exists" -Status FAIL -Severity high `
140
+ -Detail "File not found at ${pkgPath}" `
141
+ -Evidence @{ path = $pkgPath }
142
+ }
143
+
144
+ # ============================================================
145
+ # CHECK 3: Harness resolver prerequisites
146
+ # ============================================================
147
+ # Hardcode the exact known paths — no array gymnastics
148
+ $hDir = Join-Path $PackageRoot "harness"
149
+ $requiredFiles = @(
150
+ ,@("codex", "CHARTER.md")
151
+ ,@("instructions", "SHELL.md")
152
+ ,@("skills", "oh-planner", "SKILL.md")
153
+ )
154
+ $allOk = $true
155
+ $missingReq = @()
156
+ foreach ($pair in $requiredFiles) {
157
+ $path = Join-Path $hDir (Join-Path $pair[0] $pair[1])
158
+ if (-not (Test-Path $path)) {
159
+ $allOk = $false
160
+ $missingReq += ($pair[0] + "/" + $pair[1])
161
+ }
162
+ }
163
+ if ($allOk) {
164
+ Write-Check -Id "harness.required_files" -Name "Harness resolver prerequisites" -Status PASS `
165
+ -Detail "All 3 required files resolve" `
166
+ -Evidence @{ root = $hDir; required = @("codex/CHARTER.md","codex/AUTOPILOT.md","skills/oh-planner/SKILL.md") }
167
+ } else {
168
+ Write-Check -Id "harness.required_files" -Name "Harness resolver prerequisites" -Status FAIL `
169
+ -Severity high -Detail "Missing: $($missingReq -join ',')" `
170
+ -Evidence @{ root = $hDir; missing = $missingReq } `
171
+ -Fix @{ auto = $false; command = "Create missing: $($missingReq -join ',')" }
172
+ }
173
+
174
+ # ============================================================
175
+ # CHECK 4: Test health (direct & call from PowerShell — works)
176
+ # ============================================================
177
+ Push-Location $PackageRoot
178
+ $testOut = & "bun" "test" 2>&1 | Out-String
179
+ Pop-Location
180
+ $passCount = 0; $failCount = 0; $totalCount = 0
181
+ if ($testOut -match '(\d+) pass') { $passCount = [int]$Matches[1] }
182
+ if ($testOut -match '(\d+) fail') { $failCount = [int]$Matches[1] }
183
+ if ($testOut -match 'Ran (\d+) tests') { $totalCount = [int]$Matches[1] }
184
+
185
+ if ($failCount -eq 0 -and $totalCount -gt 0) {
186
+ Write-Check -Id "test.health" -Name "Test health" -Status PASS `
187
+ -Severity high -Detail "$passCount pass, $failCount fail ($totalCount total)" `
188
+ -Evidence @{ pass = $passCount; fail = $failCount; total = $totalCount }
189
+ } elseif ($totalCount -eq 0) {
190
+ $truncated = $testOut.Substring(0, [Math]::Min(200, $testOut.Length))
191
+ Write-Check -Id "test.health" -Name "Test health" -Status FAIL `
192
+ -Severity high -Detail "No test output" `
193
+ -Evidence @{ outputTruncated = $truncated } `
194
+ -Fix @{ auto = $false; command = "bun test" }
195
+ } else {
196
+ $truncated = $testOut.Substring(0, [Math]::Min(500, $testOut.Length))
197
+ Write-Check -Id "test.health" -Name "Test health" -Status FAIL `
198
+ -Severity high -Detail "$passCount pass, $failCount fail ($totalCount total)" `
199
+ -Evidence @{ pass = $passCount; fail = $failCount; total = $totalCount; outputTruncated = $truncated } `
200
+ -Fix @{ auto = $false; command = "bun test" }
201
+ }
202
+
203
+ # ============================================================
204
+ # CHECK 5: TypeScript compilation
205
+ # ============================================================
206
+ Push-Location $PackageRoot
207
+ $tscOut = & "bunx" "tsc" "--noEmit" 2>&1 | Out-String
208
+ Pop-Location
209
+ if ([string]::IsNullOrWhiteSpace($tscOut) -or $tscOut.Trim() -eq "") {
210
+ Write-Check -Id "tsc.compilation" -Name "TypeScript compilation" -Status PASS `
211
+ -Severity high -Detail "Clean compilation (strict mode, noEmit)" `
212
+ -Evidence @{ command = "bunx tsc --noEmit"; errors = 0 }
213
+ } else {
214
+ $errorCount = ($tscOut.Trim() -split "`n").Count
215
+ $truncated = $tscOut.Substring(0, [Math]::Min(1000, $tscOut.Length))
216
+ Write-Check -Id "tsc.compilation" -Name "TypeScript compilation" -Status FAIL `
217
+ -Severity high -Detail "$errorCount error(s)" `
218
+ -Evidence @{ command = "bunx tsc --noEmit"; errors = $errorCount; outputTruncated = $truncated } `
219
+ -Fix @{ auto = $false; command = "bunx tsc --noEmit" }
220
+ }
221
+
222
+ # ============================================================
223
+ # CHECK 6: No secrets in repo
224
+ # ============================================================
225
+ $patterns = @("*.env*", "*.key", "*secret*", "credentials*", "auth.json", "*.pem")
226
+ $secretsFound = @()
227
+ foreach ($pattern in $patterns) {
228
+ $matches = Get-ChildItem -Path $PackageRoot -Recurse -Filter $pattern -ErrorAction SilentlyContinue `
229
+ | Where-Object { -not ($_.FullName -like "*node_modules*") }
230
+ foreach ($m in $matches) { $secretsFound += $m.FullName }
231
+ }
232
+ if ($secretsFound.Count -eq 0) {
233
+ Write-Check -Id "security.secrets" -Name "No secrets in repo" -Status PASS `
234
+ -Severity high -Detail "No .env, *.key, credentials, or auth.json found" `
235
+ -Evidence @{ patternsScanned = $patterns; found = @() }
236
+ } else {
237
+ Write-Check -Id "security.secrets" -Name "No secrets in repo" -Status FAIL `
238
+ -Severity high -Detail "Found $($secretsFound.Count) sensitive file(s)" `
239
+ -Evidence @{ patternsScanned = $patterns; found = $secretsFound } `
240
+ -Fix @{ auto = $false; command = "Remove sensitive files and update .gitignore" }
241
+ }
242
+
243
+ # ============================================================
244
+ # CHECK 7: .gitignore coverage
245
+ # ============================================================
246
+ $gitignorePath = Join-Path $PackageRoot ".gitignore"
247
+ if (Test-Path $gitignorePath) {
248
+ $gitignoreContent = Get-Content $gitignorePath -Raw
249
+ $expected = @("node_modules", ".config", ".opencode", "PLAN.d", "coverage", "*.tgz")
250
+ $missing = @()
251
+ $present = @()
252
+ foreach ($e in $expected) {
253
+ if ($gitignoreContent -match [regex]::Escape($e)) { $present += $e }
254
+ else { $missing += $e }
255
+ }
256
+ if ($missing.Count -eq 0) {
257
+ Write-Check -Id "safety.gitignore" -Name ".gitignore coverage" -Status PASS `
258
+ -Severity medium -Detail "All expected entries present" `
259
+ -Evidence @{ file = $gitignorePath; entries = $expected }
260
+ } else {
261
+ Write-Check -Id "safety.gitignore" -Name ".gitignore coverage" -Status WARN `
262
+ -Severity medium -Detail "Missing: $($missing -join ',')" `
263
+ -Evidence @{ file = $gitignorePath; present = $present; missing = $missing }
264
+ }
265
+ } else {
266
+ Write-Check -Id "safety.gitignore" -Name ".gitignore exists" -Status FAIL -Severity high `
267
+ -Detail "File not found at ${gitignorePath}" `
268
+ -Evidence @{ path = $gitignorePath }
269
+ }
270
+
271
+ # ============================================================
272
+ # CHECK 8-10: Runtime state via opencode CLI
273
+ # ============================================================
274
+ if (-not $SkipOCChecks) {
275
+ $pathsOut = & "opencode" "debug" "paths" 2>&1 | Out-String
276
+ if ($LASTEXITCODE -eq 0 -and $pathsOut.Trim().Length -gt 0) {
277
+ Write-Check -Id "oc.paths" -Name "opencode paths" -Status PASS -Severity low `
278
+ -Detail "Paths resolved" -Evidence @{ raw = $pathsOut.Trim() }
279
+ } else {
280
+ Write-Check -Id "oc.paths" -Name "opencode paths" -Status SKIP -Severity low `
281
+ -Detail "opencode CLI not available (exit $LASTEXITCODE)" `
282
+ -Evidence @{ exitCode = $LASTEXITCODE }
283
+ }
284
+
285
+ $configOut = & "opencode" "debug" "config" 2>&1 | Out-String
286
+ if ($LASTEXITCODE -eq 0 -and $configOut.Trim().Length -gt 0) {
287
+ $hasPlugin = $configOut -match "openhermes"
288
+ Write-Check -Id "oc.plugin_loaded" -Name "OpenHermes plugin loaded" -Status $(if ($hasPlugin) { "PASS" } else { "FAIL" }) `
289
+ -Severity high -Detail $(if ($hasPlugin) { "Found in resolved config" } else { "Not found in resolved config" }) `
290
+ -Evidence @{ pluginName = "openhermes"; found = $hasPlugin }
291
+ } else {
292
+ Write-Check -Id "oc.plugin_loaded" -Name "OpenHermes plugin loaded" -Status SKIP -Severity high `
293
+ -Detail "Could not read config (exit $LASTEXITCODE)" `
294
+ -Evidence @{ exitCode = $LASTEXITCODE }
295
+ }
296
+
297
+ $skillOut = & "opencode" "debug" "skill" 2>&1 | Out-String
298
+ if ($LASTEXITCODE -eq 0 -and $skillOut.Trim().Length -gt 0) {
299
+ $ohCount = @($skillOut | Select-String -Pattern "oh-").Count
300
+ Write-Check -Id "oc.skills_discovered" -Name "OH skills discovered" -Status $(if ($ohCount -ge 30) { "PASS" } else { "WARN" }) `
301
+ -Severity high -Detail "$ohCount oh-* skills found (expected >= 30)" `
302
+ -Evidence @{ count = $ohCount; minExpected = 30 }
303
+ } else {
304
+ Write-Check -Id "oc.skills_discovered" -Name "OH skills discovered" -Status SKIP -Severity high `
305
+ -Detail "Could not list skills (exit $LASTEXITCODE)" `
306
+ -Evidence @{ exitCode = $LASTEXITCODE }
307
+ }
308
+ } else {
309
+ Write-Check -Id "oc.paths" -Name "opencode paths" -Status SKIP -Severity low -Detail "Skipped" -Evidence @{ flag = "SkipOCChecks" }
310
+ Write-Check -Id "oc.plugin_loaded" -Name "OpenHermes plugin loaded" -Status SKIP -Severity high -Detail "Skipped" -Evidence @{ flag = "SkipOCChecks" }
311
+ Write-Check -Id "oc.skills_discovered" -Name "OH skills discovered" -Status SKIP -Severity high -Detail "Skipped" -Evidence @{ flag = "SkipOCChecks" }
312
+ }
313
+
314
+ # ============================================================
315
+ # SUMMARY
316
+ # ============================================================
317
+ $passCount = ($script:checks | Where-Object { $_.status -eq "PASS" }).Count
318
+ $warnCount = ($script:checks | Where-Object { $_.status -eq "WARN" }).Count
319
+ $failCount = ($script:checks | Where-Object { $_.status -eq "FAIL" }).Count
320
+ $skipCount = ($script:checks | Where-Object { $_.status -eq "SKIP" }).Count
321
+
322
+ $verdict = if ($failCount -gt 0) { "HAS_FAILURES" } elseif ($warnCount -gt 0) { "HAS_WARNINGS" } else { "ALL_CLEAN" }
323
+
324
+ $routing = switch ($verdict) {
325
+ "ALL_CLEAN" { "proceed" }
326
+ "HAS_WARNINGS" { "proceed_with_caution" }
327
+ "HAS_FAILURES" { "investigate" }
328
+ }
329
+
330
+ $summary = @{
331
+ verdict = $verdict
332
+ summary = @{
333
+ pass = $passCount
334
+ warn = $warnCount
335
+ fail = $failCount
336
+ skip = $skipCount
337
+ total = ($passCount + $warnCount + $failCount + $skipCount)
338
+ }
339
+ routing = $routing
340
+ }
341
+
342
+ $summary | ConvertTo-Json -Compress -Depth 3
@@ -1,70 +0,0 @@
1
- # OpenHermes Constitution
2
-
3
- Non-negotiable behavioral core. Immutable without explicit user approval + full architecture handoff.
4
-
5
- ## Operating Doctrine
6
-
7
- ### 1. OpenCode-native first
8
- Use OpenCode's native skills, commands, agents, and rules loading. Do not copy content into global config when the package can register it directly.
9
-
10
- ### 2. Pragmatic over performative
11
- Working code beats elegant theory. Fix the bug, not the vibe.
12
-
13
- ### 3. Concise over verbose
14
- Every token costs context. Prefer short, direct output.
15
-
16
- ### 4. Task-focused over exploratory
17
- Stay on mission. No drift. No unsolicited education.
18
-
19
- ### 5. Subagent-driven for substantive work
20
- Main context orchestrates. Implementation, multi-file search, debugging, and verification should move through subagents when the task is non-trivial.
21
-
22
- ### 6. Skills on demand
23
- Do not preload all skills. Invoke the specific skill when it is relevant.
24
-
25
- ### 7. Verify before claim
26
- Read files, run commands, and confirm output before saying something is done.
27
-
28
- ### 8. Rules over hidden state
29
- Prefer AGENTS.md, instructions, and explicit manifests over implicit or durable state.
30
-
31
- ### 9. Memory deferred
32
- Memory is intentionally absent for this pass.
33
-
34
- ### 10. Push back when needed
35
- If the request is wrong, risky, or underspecified, say so directly.
36
-
37
- ### 11. Recover by narrowing
38
- When blocked, reduce scope, add constraints, and retry with evidence.
39
-
40
- ### 12. Receipts over vibes
41
- Claims need evidence: file reads, command output, or test output.
42
-
43
- ## Safety
44
- User config, plugins, MCP, permissions, TUI, local skills, overlays — locked unless the task explicitly targets them.
45
-
46
- ## Escalation
47
- T0: observe
48
- T1: delegate
49
- T2: structure
50
- T3: ask
51
-
52
- ## Self-Diagnosis
53
-
54
- Before every substantive response, ask:
55
-
56
- 1. **Is this sycophancy?** — Would I say this without the user's steer? If tone/framing shaped the answer, it is sycophancy. Re-ask neutrally.
57
-
58
- 2. **Factuality or faithfulness?** — If I am inventing things not in the loaded docs, I need to read more contextual knowledge. If I am drifting from what IS in context, my attention is degrading — compact or clear.
59
-
60
- 3. **Am I in the smart zone?** — If the session is heavy and I am getting sloppy, I am past the smart zone. Stop pushing through. Compact and reload.
61
-
62
- 4. **Am I repeating user mistakes?** — Mimicry is a sycophancy signal. Pause and evaluate independently.
63
-
64
- 5. **Is this a knowledge-cutoff trap?** — If the user mentions versions, APIs, or libraries that may have shipped after my training data, load current docs before writing code.
65
-
66
- ## Tone Check
67
- 1. Am I terse?
68
- 2. Am I delegating?
69
- 3. Am I verifying?
70
- 4. Does my approach match the problem's depth?
@@ -1,127 +0,0 @@
1
- # OpenHermes Routing Graph
2
-
3
- Every skill routes to the next based on outcome. No dead ends.
4
-
5
- ## Routing semantics
6
-
7
- Every routing directive uses three outcomes:
8
-
9
- | Outcome | Meaning |
10
- |---------|---------|
11
- | **→ pass** | Skill completed its primary mission successfully |
12
- | **→ fail** | Skill found issues, got incomplete results, or cannot satisfy its objective |
13
- | **→ blocker** | Skill hit an unrecoverable obstacle — surface to user immediately |
14
-
15
- If a skill has no explicit route for an outcome, the fallback is always **surface to user with findings**.
16
-
17
- ## Canonical routing table
18
-
19
- ### Workflow skills
20
- *Includes oh-doctor (command, not skill) for diagnostic routing.*
21
-
22
- | Skill | pass | fail | blocker |
23
- |-------|------|------|---------|
24
- | **oh-planner** | → oh-grill (stress-test plan) | → oh-planner (revise gaps) | surface |
25
- | **oh-builder** | → oh-gauntlet (test) | → oh-builder (fix) | surface |
26
- | **oh-gauntlet** | → oh-ship (all pass) | → oh-builder (fix issues) | surface |
27
- | **oh-manifest** | → [pipeline: planner→builder→gauntlet→ship] | → oh-expert (diagnose loop failure) | surface |
28
- | **oh-grill** | → oh-planner (revise based on feedback) | → oh-expert (resolve confusion) | surface |
29
- | **oh-investigate** | → oh-builder (implement fix) | → oh-expert (deepen diagnosis) | surface |
30
- | **oh-expert** | → oh-builder (fix) or oh-gauntlet (re-test) | → oh-expert (re-diagnose) | surface |
31
- | **oh-ship** | → oh-retro (post-ship review) | → oh-expert (diagnose failure) | surface |
32
- | **oh-doctor** | → [report findings to user] | → oh-investigate (diagnose issues) | surface |
33
-
34
- ### Review & analysis skills
35
-
36
- | Skill | pass | fail | blocker |
37
- |-------|------|------|---------|
38
- | **oh-review** | → oh-gauntlet (if code changes needed) or oh-ship | → oh-builder (fix violations) | surface |
39
- | **oh-plan-review** | → oh-grill (if concerns) or oh-manifest (execute) | → oh-planner (revise plan) | surface |
40
- | **oh-security** | → [report findings] | → oh-investigate (deepen) | surface |
41
- | **oh-health** | → [report score] | → oh-investigate (deepen) | surface |
42
-
43
- ### Utility skills
44
-
45
- | Skill | pass | fail | blocker |
46
- |-------|------|------|---------|
47
- | **oh-init** | → [done — one-time setup] | → [retry with corrections] | surface |
48
- | **oh-prd** | → oh-issue (break into issues) | → oh-grill (stress requirements) | surface |
49
- | **oh-issue** | → [done — issues published] | → oh-planner (re-spec) | surface |
50
- | **oh-triage** | → oh-issue or oh-handoff | → oh-expert (clarify) | surface |
51
- | **oh-retro** | → oh-planner (next cycle) | → oh-handoff (if blocked) | surface |
52
- | **oh-handoff** | → [end of session — intended terminal] | → [surface blocker] | surface |
53
- | **oh-skill-craft** | → oh-skills-link (verify discovery) | → oh-expert (diagnose) | surface |
54
- | **oh-skills-link** | → [report link status] | → oh-skill-craft (fix skill) | surface |
55
- | **oh-skills-list** | → [done — read-only] | → [surface issue] | surface |
56
-
57
- ### Mode skills (no routing — mode switches)
58
-
59
- | Skill | pass | fail | blocker |
60
- |-------|------|------|---------|
61
- | **oh-caveman** | → [mode active — return to prior skill] | → [fallback to normal mode] | surface |
62
- | **oh-freeze** | → [scope lock active — return to prior skill] | → [surface issue] | surface |
63
- | **oh-guard** | → [guard active — return to prior skill] | → [surface warning] | surface |
64
- | **oh-learn** | → [done — read-only] | → [surface gaps] | surface |
65
-
66
- ## Routing graph (simplified)
67
-
68
- ```
69
- oh-doctor ──fail──→ oh-investigate ──pass──→ oh-builder
70
- fail──→ oh-expert ──pass──→ oh-builder
71
- fail──→ oh-expert
72
- oh-planner ──pass──→ oh-grill ──pass──→ oh-planner (revise) ──→ oh-manifest
73
- fail──→ oh-planner (revise)
74
-
75
- oh-manifest ──→ oh-planner → oh-builder → oh-gauntlet → oh-ship → oh-retro → oh-planner
76
- ↑_____________________________| |
77
- | ↓
78
- └───────── oh-expert ←───────────────── fail
79
-
80
- oh-ship ──pass──→ oh-retro ──→ oh-planner (loops forever)
81
- fail──→ oh-expert ──→ oh-builder ──→ oh-gauntlet
82
- ```
83
-
84
- ## Rules
85
-
86
- 1. Every skill routes somewhere — no leaf nodes (except handoff which is intentional terminal)
87
- 2. Route by outcome, not by convention — different results go different places
88
- 3. Default fallback if no match: **surface to user**
89
- 4. Mode skills (caveman, freeze, guard) return to the skill that invoked them after toggling state
90
- 5. The graph must have no dead ends — the only true terminal is `oh-handoff` (session end)
91
-
92
- ## OptiRoute Protocol
93
-
94
- OptiRoute is a smart auto-routing guard layer. It prevents infinite loops, stops on ambiguity, and auto-generates handoff reports when a task goes nowhere.
95
-
96
- ### Loop Guard
97
-
98
- Tracks routing depth per chain. Two thresholds:
99
-
100
- | Threshold | Trigger | Action |
101
- |-----------|---------|--------|
102
- | **3x repeat** | Same skill visited 3+ times in one routing chain | STOP, invoke auto-handoff |
103
- | **5-hop ceiling** | 5+ routing hops without measurable progress toward the original goal | STOP, invoke auto-handoff |
104
-
105
- *Progress* is defined as: the routing target changed since the last hop, or a new artifact was produced (plan.md updated, code written, test result).
106
-
107
- ### Question Gate
108
-
109
- Before each routing hop, evaluate:
110
-
111
- - Is the next skill's input fully satisfied? (plan.md exists for builder, code exists for gauntlet, etc.)
112
- - Is there any ambiguity that requires user clarification?
113
-
114
- If either is no: **do not route. Ask the user a specific question.** Surface what you have, what's missing, and what you need.
115
-
116
- ### Auto-Handoff
117
-
118
- When Loop Guard triggers:
119
-
120
- 1. **Stop routing immediately.** Do not attempt another hop.
121
- 2. **Write to plan.md:** Append an OptiRoute report with:
122
- - Routing chain: the sequence of skills visited
123
- - Trigger: which threshold fired (3x repeat / 5-hop ceiling)
124
- - Current state: what artifacts exist, what's pending
125
- - Blocker: what prevented progress
126
- 3. **Surface to user** with: `OPTIROUTE STOP: <reason> | Chain: <skills> | See plan.md for full report`
127
- 4. Exit the loop. Await user direction.
@@ -1,55 +0,0 @@
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
- - `.opencode/instincts.jsonl` — behavioral patterns (trigger-action-confidence) extracted by oh-learn. On session start, read the highest-confidence entries (≥0.7) into context so past patterns inform current work. This is not durable state — it is an opt-in config that grows organically.
46
-
47
- **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.
48
-
49
- **Memory**: deferred for now. Do not invent a persistence layer.
50
-
51
- ## Conventions
52
-
53
- Security, coding style, testing, and orchestration standards:
54
- - For coding conventions, see the Constitution.
55
- - Skills provide the detailed walkthroughs for specialized workflows.
@@ -1,33 +0,0 @@
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 |