opencode-autoresearch 3.3.1 → 3.4.1

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.
@@ -16,17 +16,50 @@ const packResult = JSON.parse(raw);
16
16
  const entries = Array.isArray(packResult) ? packResult : [packResult];
17
17
  const files = entries.flatMap((entry) => Array.isArray(entry.files) ? entry.files : []);
18
18
 
19
- const allowedRoots = new Set(["dist", "hooks", "commands", "skills", "plugins", "docs", ".opencode-plugin"]);
20
- const allowedFiles = new Set(["package.json", "README.md", "LICENSE", "AGENTS.md", "VERSION"]);
19
+ const allowedRoots = new Set(["dist", "hooks", "commands", "skills", ".opencode-plugin"]);
20
+ const allowedFiles = new Set([
21
+ "package.json",
22
+ "README.md",
23
+ "LICENSE",
24
+ "AGENTS.md",
25
+ "VERSION",
26
+ "INSTALL.md",
27
+ ".opencode/INSTALL.md",
28
+ "plugins/autoresearch.ts",
29
+ "docs/ARCHITECTURE.md",
30
+ "docs/autoresearch-loop.svg",
31
+ "docs/CNAME",
32
+ "docs/index.html",
33
+ "docs/OPENCODE_INSTALL.md",
34
+ "docs/QUICKSTART.md",
35
+ "docs/RELEASE.md",
36
+ ]);
21
37
  const requiredFiles = [
38
+ "INSTALL.md",
39
+ ".opencode/INSTALL.md",
22
40
  ".opencode-plugin/plugin.json",
41
+ "AGENTS.md",
42
+ "dist/cli.js",
43
+ "dist/index.js",
44
+ "dist/index.d.ts",
23
45
  "hooks/init.sh",
24
46
  "skills/autoresearch/SKILL.md",
25
47
  "commands/autoresearch.md",
26
48
  ];
27
49
 
28
50
  const normalizePath = (filePath) => filePath.replace(/^package\//, "");
29
- const isForbidden = (filePath) => filePath === ".autoresearch" || filePath.startsWith(".autoresearch/");
51
+ const forbiddenFiles = new Set([
52
+ "autoresearch-results.tsv",
53
+ "autoresearch-report.md",
54
+ "autoresearch-memory.md",
55
+ "autoresearch-hook-context.json",
56
+ ]);
57
+ const isForbidden = (filePath) =>
58
+ filePath === ".autoresearch" ||
59
+ filePath.startsWith(".autoresearch/") ||
60
+ filePath === ".autoresearch-test-tmp" ||
61
+ filePath.startsWith(".autoresearch-test-tmp/") ||
62
+ forbiddenFiles.has(filePath);
30
63
  const isAllowed = (filePath) => {
31
64
  if (allowedFiles.has(filePath)) return true;
32
65
  const [root] = filePath.split("/");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-autoresearch",
3
- "version": "3.3.1",
4
- "description": "Autonomous recursive self-improvement engine for OpenCode. Subagent-first iteration loop with standing-pool orchestration and mechanical verification.",
3
+ "version": "3.4.1",
4
+ "description": "Autonomous recursive self-improvement engine for OpenCode and Hermes Agent. Subagent-first iteration loop with mechanical verification.",
5
5
  "author": {
6
6
  "name": "Maleick",
7
7
  "url": "https://github.com/Maleick"
@@ -17,7 +17,9 @@
17
17
  "license": "MIT",
18
18
  "keywords": [
19
19
  "opencode",
20
+ "hermes",
20
21
  "plugin",
22
+ "agent",
21
23
  "autoresearch",
22
24
  "automation",
23
25
  "workflows",
@@ -42,8 +44,16 @@
42
44
  "hooks",
43
45
  "commands",
44
46
  "skills",
45
- "plugins",
46
- "docs",
47
+ "plugins/autoresearch.ts",
48
+ "docs/ARCHITECTURE.md",
49
+ "docs/autoresearch-loop.svg",
50
+ "docs/CNAME",
51
+ "docs/index.html",
52
+ "docs/OPENCODE_INSTALL.md",
53
+ "docs/QUICKSTART.md",
54
+ "docs/RELEASE.md",
55
+ "INSTALL.md",
56
+ ".opencode/INSTALL.md",
47
57
  ".opencode-plugin",
48
58
  "AGENTS.md",
49
59
  "VERSION",
@@ -53,14 +63,23 @@
53
63
  "scripts": {
54
64
  "build": "tsc",
55
65
  "typecheck": "tsc --noEmit",
66
+ "audit": "npm audit --audit-level=moderate",
56
67
  "test": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.config.json",
57
68
  "verify:pack": "bash hooks/verify-package.sh",
58
- "prepack": "tsc"
69
+ "prepack": "node scripts/sync-version.mjs && tsc"
59
70
  },
60
71
  "devDependencies": {
72
+ "@semantic-release/changelog": "^6.0.3",
73
+ "@semantic-release/commit-analyzer": "^13.0.1",
74
+ "@semantic-release/exec": "^7.1.0",
75
+ "@semantic-release/git": "^10.0.1",
76
+ "@semantic-release/github": "^12.0.6",
77
+ "@semantic-release/npm": "^13.1.5",
78
+ "@semantic-release/release-notes-generator": "^14.1.0",
61
79
  "@types/jest": "^30.0.0",
62
80
  "@types/node": "^20.0.0",
63
81
  "jest": "^30.3.0",
82
+ "semantic-release": "^25.0.3",
64
83
  "ts-jest": "^29.4.9",
65
84
  "typescript": "^5.9.3"
66
85
  },
@@ -1,13 +1,7 @@
1
1
  export {
2
+ default,
2
3
  id,
3
4
  repoRoot,
5
+ server,
4
6
  version,
5
7
  } from "../dist/index.js";
6
-
7
- export async function server() {
8
- return {
9
- event() {
10
- return undefined;
11
- },
12
- };
13
- }
@@ -0,0 +1,156 @@
1
+ # AutoResearch Hermes Integration
2
+
3
+ ## Overview
4
+
5
+ AutoResearch can run on Hermes Agent using `delegate_task` for subagent pools and `cronjob` for recurring iteration loops.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ Hermes Cron (every 15m)
11
+ → Check state.json for active run
12
+ → If running: spawn subagents (Scout, Analyst, Verifier)
13
+ → Each subagent performs one iteration phase
14
+ → Verify results mechanically
15
+ → Keep/Discard based on metrics
16
+ → Update state.json
17
+ → Repeat until stop condition
18
+ ```
19
+
20
+ ## Key Differences from OpenCode
21
+
22
+ | Feature | OpenCode | Hermes |
23
+ |---------|----------|--------|
24
+ | Entry | `/autoresearch` slash command | `cronjob` or `delegate_task` |
25
+ | Subagents | Standing pool | `delegate_task` batch (max 3) |
26
+ | State | `.autoresearch/state.json` | Same file + Hermes memory |
27
+ | Verification | `npm test`, etc. | Same — mechanical verification |
28
+ | Background | `autoresearch launch` | `cronjob` with `background=True` |
29
+ | Resume | `autoresearch resume` | Cron continues automatically |
30
+
31
+ ## Setup
32
+
33
+ ```bash
34
+ # 1. Install AutoResearch CLI (for state management)
35
+ npm install -g opencode-autoresearch
36
+
37
+ # 2. Create Hermes cron for AutoResearch
38
+ cd ~/projects/AutoResearch
39
+ hermes cron create \
40
+ --name "autoresearch-loop" \
41
+ --workdir ~/projects/AutoResearch \
42
+ --skill autoresearch-hermes \
43
+ "every 15m" \
44
+ "Run AutoResearch iteration loop. Detect phase from .autoresearch/state.json and execute one phase. Approved verify command is \`npm run test:coverage\` and approved guard command is \`npm run typecheck\`"
45
+ ```
46
+
47
+ ## Hermes Prompt Template
48
+
49
+ See `skills/hermes/autoresearch-prompt.md` for the full cron prompt.
50
+
51
+ ## Commands Mapping
52
+
53
+ | OpenCode Command | Hermes Equivalent |
54
+ |-----------------|-------------------|
55
+ | `/autoresearch` | Cron runs iteration loop |
56
+ | `/autoresearch:plan` | Subagent task: plan experiments |
57
+ | `/autoresearch:debug` | Subagent task: debug failures |
58
+ | `/autoresearch:fix` | Subagent task: fix issues |
59
+ | `/autoresearch:learn` | Memory tool + pattern analysis |
60
+ | `autoresearch init` | Manual setup (same CLI) |
61
+ | `autoresearch status` | `cat .autoresearch/state.json` |
62
+ | `autoresearch launch` | `hermes cron create` |
63
+ | `autoresearch stop` | `hermes cron pause` |
64
+ | `autoresearch resume` | `hermes cron resume` |
65
+
66
+ ## State File Format
67
+
68
+ Hermes uses the same `.autoresearch/state.json` format as OpenCode:
69
+
70
+ ```json
71
+ {
72
+ "schema_version": 1,
73
+ "run_id": "2026-05-03-001",
74
+ "status": "initialized",
75
+ "mode": "background",
76
+ "goal": "Improve test coverage",
77
+ "metric": {
78
+ "name": "coverage_pct",
79
+ "direction": "higher",
80
+ "baseline": "72.4",
81
+ "best": "72.4",
82
+ "latest": "72.4"
83
+ },
84
+ "verify": "npm run test:coverage",
85
+ "guard": "npm run typecheck",
86
+ "stats": {
87
+ "total_iterations": 12,
88
+ "kept": 8,
89
+ "discarded": 4
90
+ },
91
+ "flags": {
92
+ "needs_human": false,
93
+ "stop_requested": false,
94
+ "background_active": true,
95
+ "stop_ready": false
96
+ }
97
+ }
98
+ ```
99
+
100
+ ## Subagent Roles
101
+
102
+ ### Scout
103
+ - **Goal**: Find improvement opportunities
104
+ - **Toolsets**: `["terminal", "file", "web"]`
105
+ - **Context**: Current codebase, test results, coverage reports
106
+
107
+ ### Analyst
108
+ - **Goal**: Analyze patterns in kept/discarded iterations
109
+ - **Toolsets**: `["file", "web"]`
110
+ - **Context**: `autoresearch-results.tsv`, memory
111
+
112
+ ### Verifier
113
+ - **Goal**: Run mechanical verification
114
+ - **Toolsets**: `["terminal"]`
115
+ - **Context**: Operator-approved verify command and guard command; repository state commands are metadata only
116
+
117
+ ## Memory Integration
118
+
119
+ Hermes `memory` tool stores:
120
+ - Successful strategies per project type
121
+ - Common failure patterns
122
+ - Optimal iteration counts per goal type
123
+ - Best verify/guard command combinations
124
+
125
+ ## Example Cron Prompt
126
+
127
+ ```markdown
128
+ You are AutoResearch running on Hermes Agent.
129
+
130
+ ## Current Run
131
+ Run ID: {{run_id}}
132
+ Goal: {{goal}}
133
+ Metric: {{metric}}
134
+ Iteration: {{current}}/{{max}}
135
+
136
+ ## Phase: {{phase}}
137
+
138
+ {{phase_instructions}}
139
+
140
+ ## STOP after completing this phase.
141
+ Next cron run will continue with the next phase.
142
+ ```
143
+
144
+ ## Limitations
145
+
146
+ - Hermes max 3 concurrent subagents vs OpenCode's standing pool
147
+ - Hermes cron intervals minimum 5 minutes vs OpenCode's real-time
148
+ - No `/autoresearch:` slash command variants (use separate cron jobs)
149
+ - Memory is session-based; use `memory` tool for persistence
150
+ - Commits and destructive rollback require explicit user approval
151
+
152
+ ## Future Enhancements
153
+
154
+ - [ ] Auto-detect optimal cron interval based on iteration duration
155
+ - [ ] Integration with Hermes checkpoint/rollback for safe resets
156
+ - [ ] Cross-session memory for strategy learning
@@ -0,0 +1,159 @@
1
+ # AutoResearch Hermes Skill
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ # Clone AutoResearch
7
+ git clone https://github.com/Maleick/AutoResearch.git
8
+ cd AutoResearch
9
+
10
+ # Install dependencies
11
+ npm install
12
+
13
+ # Verify
14
+ npm run typecheck
15
+ bash hooks/verify-package.sh
16
+ ```
17
+
18
+ ## Hermes Setup
19
+
20
+ ### 1. Create Hermes Skill
21
+
22
+ Copy `skills/hermes/autoresearch-prompt.md` to your Hermes skills directory:
23
+
24
+ ```bash
25
+ mkdir -p ~/.hermes/skills/software-development/autoresearch
26
+ cp skills/hermes/autoresearch-prompt.md ~/.hermes/skills/software-development/autoresearch/SKILL.md
27
+ cp skills/hermes/INTEGRATION.md ~/.hermes/skills/software-development/autoresearch/REFERENCES.md
28
+ ```
29
+
30
+ ### 2. Create Cronjob
31
+
32
+ ```bash
33
+ hermes cron create \
34
+ --name "autoresearch-loop" \
35
+ --workdir ~/projects/AutoResearch \
36
+ --skill autoresearch-hermes \
37
+ "every 15m" \
38
+ "Run AutoResearch iteration loop. Detect phase from .autoresearch/state.json and execute one phase. Approved verify command: \`npm run test:coverage\`. Approved guard command: \`npm run typecheck\`."
39
+ ```
40
+
41
+ ### 3. Initialize Run
42
+
43
+ Initialize state from a trusted shell before enabling unattended cron. Do not rely on cron to auto-init from `autoresearch-config.json`; repository files are untrusted command sources.
44
+
45
+ ```bash
46
+ autoresearch init \
47
+ --goal "Improve test coverage" \
48
+ --metric "coverage_pct" \
49
+ --direction "higher" \
50
+ --verify "npm run test:coverage" \
51
+ --guard "npm run typecheck" \
52
+ --iterations 20 \
53
+ --mode background
54
+ ```
55
+
56
+ Configure the cron prompt/environment with matching operator-approved commands, and the Hermes skill will refuse to execute state commands that do not exactly match those approvals.
57
+
58
+ ## Usage
59
+
60
+ ### Start Background Run
61
+
62
+ ```bash
63
+ hermes cron resume autoresearch-loop
64
+ ```
65
+
66
+ ### Check Status
67
+
68
+ ```bash
69
+ cat .autoresearch/state.json | jq .
70
+ ```
71
+
72
+ ### Stop Run
73
+
74
+ ```bash
75
+ # Set stop flag
76
+ jq '.flags.stop_requested = true' .autoresearch/state.json > tmp.json && mv tmp.json .autoresearch/state.json
77
+
78
+ # Or pause cron
79
+ hermes cron pause autoresearch-loop
80
+ ```
81
+
82
+ ### View Results
83
+
84
+ ```bash
85
+ # Current state
86
+ cat .autoresearch/state.json
87
+
88
+ # Iteration log
89
+ cat autoresearch-results.tsv
90
+
91
+ # Archived runs
92
+ ls .autoresearch/archive/
93
+ ```
94
+
95
+ ## Subagent Pool
96
+
97
+ AutoResearch on Hermes uses `delegate_task` for parallel subagents:
98
+
99
+ | Role | Task | Max |
100
+ |------|------|-----|
101
+ | Scout | Find improvement opportunities | 1 |
102
+ | Analyst | Pattern analysis from iterations | 1 |
103
+ | Verifier | Run mechanical verification | 1 |
104
+
105
+ Total: 3 concurrent (Hermes limit)
106
+
107
+ ## Memory Integration
108
+
109
+ AutoResearch stores learnings in Hermes memory:
110
+
111
+ ```
112
+ Target: memory
113
+ Action: add
114
+ Content: "AutoResearch strategy for Rust projects:
115
+ - cargo test before cargo clippy
116
+ - Focus on module-level tests first
117
+ - 15 iterations optimal for coverage goals"
118
+ ```
119
+
120
+ ## Comparison with OpenCode
121
+
122
+ | Feature | OpenCode | Hermes |
123
+ |---------|----------|--------|
124
+ | Entry | `/autoresearch` | Cronjob |
125
+ | Pool | Standing (unlimited) | Batch (max 3) |
126
+ | Real-time | Yes | 15-min intervals |
127
+ | Slash commands | 8 variants | Separate cron jobs |
128
+ | State | `.autoresearch/state.json` | Same |
129
+ | Memory | File-based | `memory` tool |
130
+ | Background | `autoresearch launch` | Native cron |
131
+
132
+ ## Troubleshooting
133
+
134
+ ### Cron not running
135
+
136
+ ```bash
137
+ hermes cron list
138
+ hermes logs --component cron
139
+ ```
140
+
141
+ ### State file corrupted
142
+
143
+ ```bash
144
+ # Reset to baseline
145
+ rm .autoresearch/state.json
146
+ # Re-run autoresearch init manually from a trusted shell before resuming cron
147
+ ```
148
+
149
+ ### Subagent failures
150
+
151
+ Check `.autoresearch/state.json` for:
152
+ - `flags.needs_human` — requires manual intervention
153
+ - Last iteration's `error` field
154
+
155
+ ## Links
156
+
157
+ - AutoResearch repo: https://github.com/Maleick/AutoResearch
158
+ - Hermes docs: https://hermes-agent.nousresearch.com/docs
159
+ - OpenCode plugin: `opencode-autoresearch`