nex-code 0.4.25 → 0.4.27
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/dist/nex-code.js +105 -105
- package/dist/skills/autoresearch.js +32 -6
- package/package.json +2 -2
- package/dist/skills/skills/autoresearch.js +0 -975
- package/dist/skills/skills/devops.md +0 -43
- package/dist/skills/skills/session-search.js +0 -180
- package/dist/skills/skills/skill-learning.js +0 -304
|
@@ -18,6 +18,16 @@ const { execSync } = require("child_process");
|
|
|
18
18
|
const fs = require("fs");
|
|
19
19
|
const path = require("path");
|
|
20
20
|
|
|
21
|
+
// Lazy-load agent to reset read guards between experiments
|
|
22
|
+
function resetReadGuards() {
|
|
23
|
+
try {
|
|
24
|
+
const { resetSessionTracking } = require("../agent");
|
|
25
|
+
resetSessionTracking();
|
|
26
|
+
} catch {
|
|
27
|
+
// agent not available (e.g. in tests) — no-op
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
// Lazy-load benchmark to avoid circular deps and keep startup fast
|
|
22
32
|
let _benchmark = null;
|
|
23
33
|
function getBenchmark() {
|
|
@@ -123,15 +133,25 @@ module.exports = {
|
|
|
123
133
|
When the user starts an autoresearch loop with /autoresearch <goal>, follow this cycle:
|
|
124
134
|
|
|
125
135
|
1. **Setup branch** using skill_ar_setup_branch to create a dedicated autoresearch/<tag> branch
|
|
126
|
-
2. **
|
|
127
|
-
3. **Hypothesize** a specific change
|
|
136
|
+
2. **Baseline**: run ONE measurement command (e.g. wc -c, npm run build, a benchmark script) to get the starting metric — do NOT read every file first
|
|
137
|
+
3. **Hypothesize** a specific, small change to ONE file
|
|
128
138
|
4. **Commit checkpoint** using skill_ar_checkpoint before making changes
|
|
129
|
-
5. **Edit** the code
|
|
130
|
-
6. **Run experiment** using skill_ar_run_experiment with the
|
|
139
|
+
5. **Edit** the code — make the change immediately, do not investigate further
|
|
140
|
+
6. **Run experiment** using skill_ar_run_experiment with the same measurement command
|
|
131
141
|
7. **Log result** using skill_ar_log_experiment with the outcome
|
|
132
|
-
8. **Decide**: If improved, keep
|
|
142
|
+
8. **Decide**: If improved, keep. If worse, skill_ar_revert immediately
|
|
133
143
|
9. **Repeat** from step 3 — do NOT stop unless the user interrupts
|
|
134
144
|
|
|
145
|
+
## CRITICAL: Move Fast, Investigate Less
|
|
146
|
+
|
|
147
|
+
You are a researcher running rapid experiments, NOT a code reviewer.
|
|
148
|
+
- **Baseline first**: measure the metric BEFORE reading any code
|
|
149
|
+
- **One file per experiment**: pick the most promising file, read it ONCE, make ONE targeted change
|
|
150
|
+
- **Never read all files** before making your first change — that wastes the entire context window
|
|
151
|
+
- **Max 3 reads before editing**: if you have read 3 files/ranges without making an edit, STOP reading and make a change based on what you know
|
|
152
|
+
- **Each experiment should take under 2 minutes**: read one file, edit it, measure, log, move on
|
|
153
|
+
- **Prefer bash for metrics**: use bash commands (wc -c, time, du) for measurements — they are fast and don't consume context
|
|
154
|
+
|
|
135
155
|
## Simplicity Criterion
|
|
136
156
|
|
|
137
157
|
Not every metric improvement is worth keeping. Weigh complexity cost against improvement:
|
|
@@ -419,6 +439,9 @@ Use ar_run_experiment with output_file to redirect, then ar_extract_metric to re
|
|
|
419
439
|
|
|
420
440
|
const hash = gitHash();
|
|
421
441
|
|
|
442
|
+
// Reset read guards so the agent can re-read files in the next experiment
|
|
443
|
+
resetReadGuards();
|
|
444
|
+
|
|
422
445
|
return JSON.stringify({
|
|
423
446
|
status: "checkpoint_created",
|
|
424
447
|
commit: hash,
|
|
@@ -895,13 +918,16 @@ Use ar_run_experiment with output_file to redirect, then ar_extract_metric to re
|
|
|
895
918
|
|
|
896
919
|
const newHash = gitHash();
|
|
897
920
|
|
|
921
|
+
// Reset read guards — files changed after revert, agent needs fresh access
|
|
922
|
+
resetReadGuards();
|
|
923
|
+
|
|
898
924
|
return JSON.stringify({
|
|
899
925
|
status: "reverted",
|
|
900
926
|
method: "reset",
|
|
901
927
|
reverted_from: currentHash,
|
|
902
928
|
reverted_to: newHash,
|
|
903
929
|
reason: args.reason,
|
|
904
|
-
note: "Branch pointer moved back — failed experiment removed from history.",
|
|
930
|
+
note: "Branch pointer moved back — failed experiment removed from history. Read guards reset — you can re-read files.",
|
|
905
931
|
});
|
|
906
932
|
} catch (err) {
|
|
907
933
|
// Fallback to checkout if reset fails
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nex-code",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.27",
|
|
4
4
|
"description": "Run 400B+ open coding models on your codebase without the hardware bill. Ollama Cloud first — OpenAI, Anthropic, and Gemini when you need them.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"nex-code": "./dist/nex-code.js"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "node dist/nex-code.js",
|
|
19
|
-
"build": "esbuild bin/nex-code.js --bundle --platform=node --target=node18 --outfile=dist/nex-code.js --minify --external:axios --external:dotenv --external:playwright && cp -r cli/skills dist/skills",
|
|
19
|
+
"build": "esbuild bin/nex-code.js --bundle --platform=node --target=node18 --outfile=dist/nex-code.js --minify --external:axios --external:dotenv --external:playwright && rm -rf dist/skills && cp -r cli/skills dist/skills",
|
|
20
20
|
"dev": "esbuild bin/nex-code.js --bundle --platform=node --target=node18 --outfile=dist/nex-code.js --external:axios --external:dotenv --external:playwright --watch",
|
|
21
21
|
"test": "jest --forceExit",
|
|
22
22
|
"test:orchestrator": "jest tests/orchestrator.test.js --forceExit",
|