nreki 0.0.0-stage → 12.3.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/CHANGELOG.md +2733 -0
- package/LICENSE +191 -0
- package/README.md +216 -2
- package/bin/nreki.cjs +11 -0
- package/dist/ast-navigator.d.ts +32 -0
- package/dist/ast-navigator.d.ts.map +1 -0
- package/dist/ast-navigator.js +430 -0
- package/dist/ast-navigator.js.map +1 -0
- package/dist/ast-sandbox.d.ts +92 -0
- package/dist/ast-sandbox.d.ts.map +1 -0
- package/dist/ast-sandbox.js +389 -0
- package/dist/ast-sandbox.js.map +1 -0
- package/dist/audit.d.ts +49 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +598 -0
- package/dist/audit.js.map +1 -0
- package/dist/bootstrap-root.d.ts +8 -0
- package/dist/bootstrap-root.d.ts.map +1 -0
- package/dist/bootstrap-root.js +9 -0
- package/dist/bootstrap-root.js.map +1 -0
- package/dist/chronos-memory.d.ts +77 -0
- package/dist/chronos-memory.d.ts.map +1 -0
- package/dist/chronos-memory.js +312 -0
- package/dist/chronos-memory.js.map +1 -0
- package/dist/circuit-breaker.d.ts +109 -0
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/circuit-breaker.js +350 -0
- package/dist/circuit-breaker.js.map +1 -0
- package/dist/compressor-foveal-cross-file.d.ts +80 -0
- package/dist/compressor-foveal-cross-file.d.ts.map +1 -0
- package/dist/compressor-foveal-cross-file.js +322 -0
- package/dist/compressor-foveal-cross-file.js.map +1 -0
- package/dist/compressor-foveal.d.ts +62 -0
- package/dist/compressor-foveal.d.ts.map +1 -0
- package/dist/compressor-foveal.js +351 -0
- package/dist/compressor-foveal.js.map +1 -0
- package/dist/compressor.d.ts +122 -0
- package/dist/compressor.d.ts.map +1 -0
- package/dist/compressor.js +518 -0
- package/dist/compressor.js.map +1 -0
- package/dist/database.d.ts +369 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +1534 -0
- package/dist/database.js.map +1 -0
- package/dist/detect-mode.d.ts +2 -0
- package/dist/detect-mode.d.ts.map +1 -0
- package/dist/detect-mode.js +68 -0
- package/dist/detect-mode.js.map +1 -0
- package/dist/engine/indexer.d.ts +32 -0
- package/dist/engine/indexer.d.ts.map +1 -0
- package/dist/engine/indexer.js +394 -0
- package/dist/engine/indexer.js.map +1 -0
- package/dist/engine/searcher.d.ts +30 -0
- package/dist/engine/searcher.d.ts.map +1 -0
- package/dist/engine/searcher.js +184 -0
- package/dist/engine/searcher.js.map +1 -0
- package/dist/engine-types.d.ts +89 -0
- package/dist/engine-types.d.ts.map +1 -0
- package/dist/engine-types.js +8 -0
- package/dist/engine-types.js.map +1 -0
- package/dist/engine.d.ts +224 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +917 -0
- package/dist/engine.js.map +1 -0
- package/dist/eslint-sidecar.d.ts +21 -0
- package/dist/eslint-sidecar.d.ts.map +1 -0
- package/dist/eslint-sidecar.js +170 -0
- package/dist/eslint-sidecar.js.map +1 -0
- package/dist/handlers/code/blast-radius.d.ts +44 -0
- package/dist/handlers/code/blast-radius.d.ts.map +1 -0
- package/dist/handlers/code/blast-radius.js +66 -0
- package/dist/handlers/code/blast-radius.js.map +1 -0
- package/dist/handlers/code/edit.d.ts +7 -0
- package/dist/handlers/code/edit.d.ts.map +1 -0
- package/dist/handlers/code/edit.js +777 -0
- package/dist/handlers/code/edit.js.map +1 -0
- package/dist/handlers/code/kernel-bridge.d.ts +32 -0
- package/dist/handlers/code/kernel-bridge.d.ts.map +1 -0
- package/dist/handlers/code/kernel-bridge.js +229 -0
- package/dist/handlers/code/kernel-bridge.js.map +1 -0
- package/dist/handlers/code/read.d.ts +7 -0
- package/dist/handlers/code/read.d.ts.map +1 -0
- package/dist/handlers/code/read.js +426 -0
- package/dist/handlers/code/read.js.map +1 -0
- package/dist/handlers/code/utils.d.ts +7 -0
- package/dist/handlers/code/utils.d.ts.map +1 -0
- package/dist/handlers/code/utils.js +135 -0
- package/dist/handlers/code/utils.js.map +1 -0
- package/dist/handlers/code/validation-banner.d.ts +62 -0
- package/dist/handlers/code/validation-banner.d.ts.map +1 -0
- package/dist/handlers/code/validation-banner.js +171 -0
- package/dist/handlers/code/validation-banner.js.map +1 -0
- package/dist/handlers/code.d.ts +10 -0
- package/dist/handlers/code.d.ts.map +1 -0
- package/dist/handlers/code.js +10 -0
- package/dist/handlers/code.js.map +1 -0
- package/dist/handlers/context-pack.d.ts +63 -0
- package/dist/handlers/context-pack.d.ts.map +1 -0
- package/dist/handlers/context-pack.js +1046 -0
- package/dist/handlers/context-pack.js.map +1 -0
- package/dist/handlers/guard.d.ts +18 -0
- package/dist/handlers/guard.d.ts.map +1 -0
- package/dist/handlers/guard.js +433 -0
- package/dist/handlers/guard.js.map +1 -0
- package/dist/handlers/navigate.d.ts +27 -0
- package/dist/handlers/navigate.d.ts.map +1 -0
- package/dist/handlers/navigate.js +1004 -0
- package/dist/handlers/navigate.js.map +1 -0
- package/dist/handlers/type-graph.d.ts +23 -0
- package/dist/handlers/type-graph.d.ts.map +1 -0
- package/dist/handlers/type-graph.js +201 -0
- package/dist/handlers/type-graph.js.map +1 -0
- package/dist/hologram/shadow-generator.d.ts +32 -0
- package/dist/hologram/shadow-generator.d.ts.map +1 -0
- package/dist/hologram/shadow-generator.js +878 -0
- package/dist/hologram/shadow-generator.js.map +1 -0
- package/dist/hooks/cognitive-enforcer.d.ts +60 -0
- package/dist/hooks/cognitive-enforcer.d.ts.map +1 -0
- package/dist/hooks/cognitive-enforcer.js +292 -0
- package/dist/hooks/cognitive-enforcer.js.map +1 -0
- package/dist/hooks/native-edit-ipc.d.ts +22 -0
- package/dist/hooks/native-edit-ipc.d.ts.map +1 -0
- package/dist/hooks/native-edit-ipc.js +144 -0
- package/dist/hooks/native-edit-ipc.js.map +1 -0
- package/dist/hooks/native-edit-validator.d.ts +7 -0
- package/dist/hooks/native-edit-validator.d.ts.map +1 -0
- package/dist/hooks/native-edit-validator.js +263 -0
- package/dist/hooks/native-edit-validator.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +655 -0
- package/dist/index.js.map +1 -0
- package/dist/init/agent-detect.d.ts +42 -0
- package/dist/init/agent-detect.d.ts.map +1 -0
- package/dist/init/agent-detect.js +98 -0
- package/dist/init/agent-detect.js.map +1 -0
- package/dist/init/hook-upgrade.d.ts +14 -0
- package/dist/init/hook-upgrade.d.ts.map +1 -0
- package/dist/init/hook-upgrade.js +35 -0
- package/dist/init/hook-upgrade.js.map +1 -0
- package/dist/init/init-runner.d.ts +83 -0
- package/dist/init/init-runner.d.ts.map +1 -0
- package/dist/init/init-runner.js +492 -0
- package/dist/init/init-runner.js.map +1 -0
- package/dist/init/mcp-register.d.ts +55 -0
- package/dist/init/mcp-register.d.ts.map +1 -0
- package/dist/init/mcp-register.js +451 -0
- package/dist/init/mcp-register.js.map +1 -0
- package/dist/init/trust-db.d.ts +51 -0
- package/dist/init/trust-db.d.ts.map +1 -0
- package/dist/init/trust-db.js +264 -0
- package/dist/init/trust-db.js.map +1 -0
- package/dist/kernel/backends/go-sidecar.d.ts +31 -0
- package/dist/kernel/backends/go-sidecar.d.ts.map +1 -0
- package/dist/kernel/backends/go-sidecar.js +54 -0
- package/dist/kernel/backends/go-sidecar.js.map +1 -0
- package/dist/kernel/backends/lsp-sidecar-base.d.ts +206 -0
- package/dist/kernel/backends/lsp-sidecar-base.d.ts.map +1 -0
- package/dist/kernel/backends/lsp-sidecar-base.js +864 -0
- package/dist/kernel/backends/lsp-sidecar-base.js.map +1 -0
- package/dist/kernel/backends/python-sidecar.d.ts +22 -0
- package/dist/kernel/backends/python-sidecar.d.ts.map +1 -0
- package/dist/kernel/backends/python-sidecar.js +47 -0
- package/dist/kernel/backends/python-sidecar.js.map +1 -0
- package/dist/kernel/backends/ts-compiler-wrapper.d.ts +233 -0
- package/dist/kernel/backends/ts-compiler-wrapper.d.ts.map +1 -0
- package/dist/kernel/backends/ts-compiler-wrapper.js +1451 -0
- package/dist/kernel/backends/ts-compiler-wrapper.js.map +1 -0
- package/dist/kernel/error-baseline.d.ts +20 -0
- package/dist/kernel/error-baseline.d.ts.map +1 -0
- package/dist/kernel/error-baseline.js +40 -0
- package/dist/kernel/error-baseline.js.map +1 -0
- package/dist/kernel/error-format.d.ts +20 -0
- package/dist/kernel/error-format.d.ts.map +1 -0
- package/dist/kernel/error-format.js +41 -0
- package/dist/kernel/error-format.js.map +1 -0
- package/dist/kernel/healer.d.ts +4 -0
- package/dist/kernel/healer.d.ts.map +1 -0
- package/dist/kernel/healer.js +257 -0
- package/dist/kernel/healer.js.map +1 -0
- package/dist/kernel/mutex.d.ts +7 -0
- package/dist/kernel/mutex.d.ts.map +1 -0
- package/dist/kernel/mutex.js +50 -0
- package/dist/kernel/mutex.js.map +1 -0
- package/dist/kernel/nreki-kernel.d.ts +326 -0
- package/dist/kernel/nreki-kernel.d.ts.map +1 -0
- package/dist/kernel/nreki-kernel.js +2352 -0
- package/dist/kernel/nreki-kernel.js.map +1 -0
- package/dist/kernel/spectral-topology.d.ts +93 -0
- package/dist/kernel/spectral-topology.d.ts.map +1 -0
- package/dist/kernel/spectral-topology.js +639 -0
- package/dist/kernel/spectral-topology.js.map +1 -0
- package/dist/kernel/ttrd.d.ts +15 -0
- package/dist/kernel/ttrd.d.ts.map +1 -0
- package/dist/kernel/ttrd.js +179 -0
- package/dist/kernel/ttrd.js.map +1 -0
- package/dist/kernel/types.d.ts +140 -0
- package/dist/kernel/types.d.ts.map +1 -0
- package/dist/kernel/types.js +2 -0
- package/dist/kernel/types.js.map +1 -0
- package/dist/limits.d.ts +20 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +37 -0
- package/dist/limits.js.map +1 -0
- package/dist/middleware/circuit-breaker.d.ts +29 -0
- package/dist/middleware/circuit-breaker.d.ts.map +1 -0
- package/dist/middleware/circuit-breaker.js +198 -0
- package/dist/middleware/circuit-breaker.js.map +1 -0
- package/dist/middleware/file-lock.d.ts +33 -0
- package/dist/middleware/file-lock.d.ts.map +1 -0
- package/dist/middleware/file-lock.js +62 -0
- package/dist/middleware/file-lock.js.map +1 -0
- package/dist/monitor.d.ts +94 -0
- package/dist/monitor.d.ts.map +1 -0
- package/dist/monitor.js +249 -0
- package/dist/monitor.js.map +1 -0
- package/dist/parser-pool.d.ts +30 -0
- package/dist/parser-pool.d.ts.map +1 -0
- package/dist/parser-pool.js +103 -0
- package/dist/parser-pool.js.map +1 -0
- package/dist/parser.d.ts +148 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +752 -0
- package/dist/parser.js.map +1 -0
- package/dist/pin-memory.d.ts +46 -0
- package/dist/pin-memory.d.ts.map +1 -0
- package/dist/pin-memory.js +216 -0
- package/dist/pin-memory.js.map +1 -0
- package/dist/project-root.d.ts +32 -0
- package/dist/project-root.d.ts.map +1 -0
- package/dist/project-root.js +57 -0
- package/dist/project-root.js.map +1 -0
- package/dist/repo-map.d.ts +121 -0
- package/dist/repo-map.d.ts.map +1 -0
- package/dist/repo-map.js +1086 -0
- package/dist/repo-map.js.map +1 -0
- package/dist/router.d.ts +123 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +455 -0
- package/dist/router.js.map +1 -0
- package/dist/search/fastgrep-cache.d.ts +54 -0
- package/dist/search/fastgrep-cache.d.ts.map +1 -0
- package/dist/search/fastgrep-cache.js +197 -0
- package/dist/search/fastgrep-cache.js.map +1 -0
- package/dist/search/in-degree.d.ts +53 -0
- package/dist/search/in-degree.d.ts.map +1 -0
- package/dist/search/in-degree.js +70 -0
- package/dist/search/in-degree.js.map +1 -0
- package/dist/search/keyword-index.d.ts +43 -0
- package/dist/search/keyword-index.d.ts.map +1 -0
- package/dist/search/keyword-index.js +220 -0
- package/dist/search/keyword-index.js.map +1 -0
- package/dist/search/vector-index.d.ts +93 -0
- package/dist/search/vector-index.d.ts.map +1 -0
- package/dist/search/vector-index.js +369 -0
- package/dist/search/vector-index.js.map +1 -0
- package/dist/search/voyage.d.ts +42 -0
- package/dist/search/voyage.d.ts.map +1 -0
- package/dist/search/voyage.js +106 -0
- package/dist/search/voyage.js.map +1 -0
- package/dist/semantic-edit.d.ts +105 -0
- package/dist/semantic-edit.d.ts.map +1 -0
- package/dist/semantic-edit.js +1286 -0
- package/dist/semantic-edit.js.map +1 -0
- package/dist/spectral/eigengap.d.ts +12 -0
- package/dist/spectral/eigengap.d.ts.map +1 -0
- package/dist/spectral/eigengap.js +19 -0
- package/dist/spectral/eigengap.js.map +1 -0
- package/dist/spectral/vonNeumann.d.ts +29 -0
- package/dist/spectral/vonNeumann.d.ts.map +1 -0
- package/dist/spectral/vonNeumann.js +51 -0
- package/dist/spectral/vonNeumann.js.map +1 -0
- package/dist/terminal-filter.d.ts +27 -0
- package/dist/terminal-filter.d.ts.map +1 -0
- package/dist/terminal-filter.js +255 -0
- package/dist/terminal-filter.js.map +1 -0
- package/dist/undo.d.ts +43 -0
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +177 -0
- package/dist/undo.js.map +1 -0
- package/dist/utils/code-tokenizer.d.ts +25 -0
- package/dist/utils/code-tokenizer.d.ts.map +1 -0
- package/dist/utils/code-tokenizer.js +52 -0
- package/dist/utils/code-tokenizer.js.map +1 -0
- package/dist/utils/defect-radar.d.ts +35 -0
- package/dist/utils/defect-radar.d.ts.map +1 -0
- package/dist/utils/defect-radar.js +49 -0
- package/dist/utils/defect-radar.js.map +1 -0
- package/dist/utils/engram-identity.d.ts +62 -0
- package/dist/utils/engram-identity.d.ts.map +1 -0
- package/dist/utils/engram-identity.js +102 -0
- package/dist/utils/engram-identity.js.map +1 -0
- package/dist/utils/file-filter.d.ts +30 -0
- package/dist/utils/file-filter.d.ts.map +1 -0
- package/dist/utils/file-filter.js +66 -0
- package/dist/utils/file-filter.js.map +1 -0
- package/dist/utils/file-traits.d.ts +35 -0
- package/dist/utils/file-traits.d.ts.map +1 -0
- package/dist/utils/file-traits.js +90 -0
- package/dist/utils/file-traits.js.map +1 -0
- package/dist/utils/header-router.d.ts +22 -0
- package/dist/utils/header-router.d.ts.map +1 -0
- package/dist/utils/header-router.js +52 -0
- package/dist/utils/header-router.js.map +1 -0
- package/dist/utils/import-origin.d.ts +48 -0
- package/dist/utils/import-origin.d.ts.map +1 -0
- package/dist/utils/import-origin.js +281 -0
- package/dist/utils/import-origin.js.map +1 -0
- package/dist/utils/imports.d.ts +48 -0
- package/dist/utils/imports.d.ts.map +1 -0
- package/dist/utils/imports.js +406 -0
- package/dist/utils/imports.js.map +1 -0
- package/dist/utils/latency-tracker.d.ts +22 -0
- package/dist/utils/latency-tracker.d.ts.map +1 -0
- package/dist/utils/latency-tracker.js +49 -0
- package/dist/utils/latency-tracker.js.map +1 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +49 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-guard.d.ts +59 -0
- package/dist/utils/path-guard.d.ts.map +1 -0
- package/dist/utils/path-guard.js +127 -0
- package/dist/utils/path-guard.js.map +1 -0
- package/dist/utils/path-jail.d.ts +46 -0
- package/dist/utils/path-jail.d.ts.map +1 -0
- package/dist/utils/path-jail.js +227 -0
- package/dist/utils/path-jail.js.map +1 -0
- package/dist/utils/porter-stemmer.d.ts +15 -0
- package/dist/utils/porter-stemmer.d.ts.map +1 -0
- package/dist/utils/porter-stemmer.js +179 -0
- package/dist/utils/porter-stemmer.js.map +1 -0
- package/dist/utils/qualified-name.d.ts +34 -0
- package/dist/utils/qualified-name.d.ts.map +1 -0
- package/dist/utils/qualified-name.js +42 -0
- package/dist/utils/qualified-name.js.map +1 -0
- package/dist/utils/read-source.d.ts +18 -0
- package/dist/utils/read-source.d.ts.map +1 -0
- package/dist/utils/read-source.js +22 -0
- package/dist/utils/read-source.js.map +1 -0
- package/dist/utils/safe-exec.d.ts +54 -0
- package/dist/utils/safe-exec.d.ts.map +1 -0
- package/dist/utils/safe-exec.js +190 -0
- package/dist/utils/safe-exec.js.map +1 -0
- package/dist/utils/safe-parse.d.ts +20 -0
- package/dist/utils/safe-parse.d.ts.map +1 -0
- package/dist/utils/safe-parse.js +33 -0
- package/dist/utils/safe-parse.js.map +1 -0
- package/dist/utils/spanish-query.d.ts +10 -0
- package/dist/utils/spanish-query.d.ts.map +1 -0
- package/dist/utils/spanish-query.js +123 -0
- package/dist/utils/spanish-query.js.map +1 -0
- package/dist/utils/suppression-guard.d.ts +24 -0
- package/dist/utils/suppression-guard.d.ts.map +1 -0
- package/dist/utils/suppression-guard.js +72 -0
- package/dist/utils/suppression-guard.js.map +1 -0
- package/dist/utils/test-resource-registry.d.ts +7 -0
- package/dist/utils/test-resource-registry.d.ts.map +1 -0
- package/dist/utils/test-resource-registry.js +5 -0
- package/dist/utils/test-resource-registry.js.map +1 -0
- package/dist/utils/to-posix.d.ts +9 -0
- package/dist/utils/to-posix.d.ts.map +1 -0
- package/dist/utils/to-posix.js +12 -0
- package/dist/utils/to-posix.js.map +1 -0
- package/dist/utils/token-estimator.d.ts +13 -0
- package/dist/utils/token-estimator.d.ts.map +1 -0
- package/dist/utils/token-estimator.js +46 -0
- package/dist/utils/token-estimator.js.map +1 -0
- package/dist/utils/trust.d.ts +31 -0
- package/dist/utils/trust.d.ts.map +1 -0
- package/dist/utils/trust.js +114 -0
- package/dist/utils/trust.js.map +1 -0
- package/dist/utils/type-extractor.d.ts +67 -0
- package/dist/utils/type-extractor.d.ts.map +1 -0
- package/dist/utils/type-extractor.js +296 -0
- package/dist/utils/type-extractor.js.map +1 -0
- package/package.json +114 -6
- package/scripts/download-wasm.js +65 -0
- package/src/ast-navigator.ts +492 -0
- package/src/ast-sandbox.ts +463 -0
- package/src/audit.ts +697 -0
- package/src/bootstrap-root.ts +10 -0
- package/src/chronos-memory.ts +358 -0
- package/src/circuit-breaker.ts +452 -0
- package/src/compressor-foveal-cross-file.ts +388 -0
- package/src/compressor-foveal.ts +402 -0
- package/src/compressor.ts +667 -0
- package/src/database.ts +1728 -0
- package/src/detect-mode.ts +70 -0
- package/src/engine/indexer.ts +408 -0
- package/src/engine/searcher.ts +201 -0
- package/src/engine-types.ts +92 -0
- package/src/engine.ts +1014 -0
- package/src/eslint-sidecar.ts +188 -0
- package/src/handlers/code/blast-radius.ts +74 -0
- package/src/handlers/code/edit.ts +816 -0
- package/src/handlers/code/kernel-bridge.ts +265 -0
- package/src/handlers/code/read.ts +508 -0
- package/src/handlers/code/utils.ts +165 -0
- package/src/handlers/code/validation-banner.ts +205 -0
- package/src/handlers/code.ts +10 -0
- package/src/handlers/context-pack.ts +1020 -0
- package/src/handlers/guard.ts +537 -0
- package/src/handlers/navigate.ts +1150 -0
- package/src/handlers/type-graph.ts +236 -0
- package/src/hologram/shadow-generator.ts +982 -0
- package/src/hooks/cognitive-enforcer.ts +311 -0
- package/src/hooks/native-edit-ipc.ts +151 -0
- package/src/hooks/native-edit-validator.ts +256 -0
- package/src/index.ts +744 -0
- package/src/init/agent-detect.ts +116 -0
- package/src/init/hook-upgrade.ts +35 -0
- package/src/init/init-runner.ts +541 -0
- package/src/init/mcp-register.ts +474 -0
- package/src/init/trust-db.ts +235 -0
- package/src/kernel/backends/go-sidecar.ts +56 -0
- package/src/kernel/backends/lsp-sidecar-base.ts +1021 -0
- package/src/kernel/backends/python-sidecar.ts +53 -0
- package/src/kernel/backends/ts-compiler-wrapper.ts +1593 -0
- package/src/kernel/error-baseline.ts +48 -0
- package/src/kernel/error-format.ts +54 -0
- package/src/kernel/healer.ts +298 -0
- package/src/kernel/mutex.ts +46 -0
- package/src/kernel/nreki-kernel.ts +2477 -0
- package/src/kernel/spectral-topology.ts +733 -0
- package/src/kernel/ttrd.ts +149 -0
- package/src/kernel/types.ts +154 -0
- package/src/limits.ts +44 -0
- package/src/middleware/circuit-breaker.ts +254 -0
- package/src/middleware/file-lock.ts +83 -0
- package/src/monitor.ts +362 -0
- package/src/parser-pool.ts +111 -0
- package/src/parser.ts +902 -0
- package/src/pin-memory.ts +259 -0
- package/src/project-root.ts +60 -0
- package/src/repo-map.ts +1206 -0
- package/src/router.ts +540 -0
- package/src/search/fastgrep-cache.ts +209 -0
- package/src/search/in-degree.ts +84 -0
- package/src/search/keyword-index.ts +246 -0
- package/src/search/vector-index.ts +381 -0
- package/src/search/voyage.ts +116 -0
- package/src/semantic-edit.ts +1472 -0
- package/src/spectral/eigengap.ts +22 -0
- package/src/spectral/vonNeumann.ts +48 -0
- package/src/terminal-filter.ts +311 -0
- package/src/types/sql.js.d.ts +45 -0
- package/src/undo.ts +177 -0
- package/src/utils/code-tokenizer.ts +58 -0
- package/src/utils/defect-radar.ts +81 -0
- package/src/utils/engram-identity.ts +129 -0
- package/src/utils/file-filter.ts +79 -0
- package/src/utils/file-traits.ts +96 -0
- package/src/utils/header-router.ts +53 -0
- package/src/utils/import-origin.ts +280 -0
- package/src/utils/imports.ts +404 -0
- package/src/utils/latency-tracker.ts +63 -0
- package/src/utils/logger.ts +48 -0
- package/src/utils/path-guard.ts +162 -0
- package/src/utils/path-jail.ts +225 -0
- package/src/utils/porter-stemmer.ts +161 -0
- package/src/utils/qualified-name.ts +60 -0
- package/src/utils/read-source.ts +23 -0
- package/src/utils/safe-exec.ts +194 -0
- package/src/utils/safe-parse.ts +42 -0
- package/src/utils/spanish-query.ts +123 -0
- package/src/utils/suppression-guard.ts +83 -0
- package/src/utils/test-resource-registry.ts +16 -0
- package/src/utils/to-posix.ts +13 -0
- package/src/utils/token-estimator.ts +45 -0
- package/src/utils/trust.ts +113 -0
- package/src/utils/type-extractor.ts +301 -0
- package/templates/AGENTS.md +11 -0
- package/templates/CLAUDE.md +12 -0
- package/templates/SKILL.md +30 -0
- package/templates/hooks/nreki-enforcer.mjs +385 -0
- package/wasm/.gitkeep +0 -0
- package/wasm/tree-sitter-c.wasm +0 -0
- package/wasm/tree-sitter-cpp.wasm +0 -0
- package/wasm/tree-sitter-css.wasm +0 -0
- package/wasm/tree-sitter-go.wasm +0 -0
- package/wasm/tree-sitter-html.wasm +0 -0
- package/wasm/tree-sitter-java.wasm +0 -0
- package/wasm/tree-sitter-javascript.wasm +0 -0
- package/wasm/tree-sitter-json.wasm +0 -0
- package/wasm/tree-sitter-kotlin.wasm +0 -0
- package/wasm/tree-sitter-python.wasm +0 -0
- package/wasm/tree-sitter-tsx.wasm +0 -0
- package/wasm/tree-sitter-typescript.wasm +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,2733 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [12.3.0] - 2026-11-26
|
|
4
|
+
|
|
5
|
+
`npx nreki init` now installs NREKI in one command: it writes each agent's instructions and registers NREKI as that agent's MCP server, with the project folder pinned.
|
|
6
|
+
|
|
7
|
+
Why the folder has to be pinned. NREKI indexes the folder it starts in, and on 2026-11-26 a probe MCP server measured where hosts start servers:
|
|
8
|
+
- Antigravity IDE 2.9.0 starts a global plugin's server in the plugin's own folder (`~/.gemini/config/plugins/<name>`), so NREKI would have indexed the wrong folder.
|
|
9
|
+
- It starts a workspace `.agents/mcp_config.json` server in the project.
|
|
10
|
+
- It expands none of `${workspaceFolder}`, `${WORKSPACE_ROOT}` or `${PWD}`, and it does not offer MCP roots.
|
|
11
|
+
|
|
12
|
+
Changes:
|
|
13
|
+
- **`NREKI_PROJECT_ROOT`.** When set to an existing absolute folder, the server switches to it before any module reads `process.cwd()` (`src/bootstrap-root.ts` is the first import of `index.ts`). An unexpanded `${…}`, a relative path or a missing folder is ignored with a stderr warning.
|
|
14
|
+
- **`init` registers the MCP server**:
|
|
15
|
+
- Claude Code: `.mcp.json`.
|
|
16
|
+
- Codex: `.codex/config.toml`, with `cwd`, `startup_timeout_sec = 120` (the first `npx` download took 25 s; Codex's default is 10 s) and `env_vars` forwarding the Voyage key.
|
|
17
|
+
- Antigravity: `.agents/mcp_config.json`.
|
|
18
|
+
- Cursor: `.cursor/mcp.json`, with an absolute `NREKI_PROJECT_ROOT`.
|
|
19
|
+
- VS Code/Copilot: `.vscode/mcp.json`, with `NREKI_PROJECT_ROOT=${workspaceFolder}`.
|
|
20
|
+
- Every entry pins `nreki@<version>`. On Windows it launches through `cmd /c npx`.
|
|
21
|
+
- **Updates and refusals.**
|
|
22
|
+
- Re-running `init` updates NREKI's own entry to the new version and keeps fields the user added.
|
|
23
|
+
- An entry named `nreki` that NREKI did not write is left alone unless `--force`.
|
|
24
|
+
- A JSON file with comments, or a Codex inline-table definition, is never rewritten: `init` prints the entry to add by hand.
|
|
25
|
+
- Nothing is written through a linked folder.
|
|
26
|
+
- **Agent selection.**
|
|
27
|
+
- `init` installs for every agent configured in the project. `codex` (`.codex/`) and `antigravity` (`.agents/mcp_config.json`, `.agents/rules/`, `GEMINI.md`) are new agents. Before, only the first agent detected was installed.
|
|
28
|
+
- Without project signals, it installs for the agents found in the home folder (`~/.claude`, `~/.codex`, `~/.gemini/antigravity`, `~/.cursor`), then falls back to `AGENTS.md`.
|
|
29
|
+
- `--agent` takes a comma list.
|
|
30
|
+
- Codex and Antigravity share the `AGENTS.md` block: Antigravity loads a root `AGENTS.md` as an always-on rule.
|
|
31
|
+
- **New flags:** `--voyage` / `--no-voyage` set or remove `NREKI_SEMANTIC=voyage` in the registrations. `--no-mcp` writes the instructions only. `init` ends with the steps left in each agent (approve the server in Claude Code, trust the folder in Codex, Refresh in Antigravity).
|
|
32
|
+
- **`deinit`** also removes the MCP entries NREKI wrote, and deletes a config file that held nothing else and the folders left empty.
|
|
33
|
+
- **`deinit` bugs fixed (found while testing this release):**
|
|
34
|
+
- In `CLAUDE.md` it cut from `# NREKI ACTIVE` to the end of the file. That dropped the user's text after the block and left the `<!-- nreki:begin -->` sentinel behind.
|
|
35
|
+
- It looked for an `AGENTS.md` header that the template stopped using in v12.1, so it never removed that block.
|
|
36
|
+
- It left `.claude/skills/nreki-optimizer/SKILL.md`, `.cursor/rules/nreki.mdc`, `.clinerules/nreki.md` and the `.github/copilot-instructions.md` block behind.
|
|
37
|
+
- Now it removes exactly the block `init` wrote, recognizing both the sentinels and the legacy headers.
|
|
38
|
+
- It deletes `.claude/settings.json` when only NREKI's hooks were in it.
|
|
39
|
+
- Measured on a project with all five agents installed: the old `deinit` left 13 files; the new one leaves only the user's.
|
|
40
|
+
|
|
41
|
+
Tests: `tests/init-mcp-register.test.ts`. One of them starts the real server from an empty folder with `NREKI_PROJECT_ROOT` pointing at a project and finds a symbol there. Without the bootstrap import, that test and the import-order test fail.
|
|
42
|
+
|
|
43
|
+
## [12.2.0] - 2026-11-26
|
|
44
|
+
|
|
45
|
+
- The npm package is renamed to `nreki` (unscoped). Releases up to 12.0.0 were published as `@ruso-0/nreki`. `npx nreki` replaces `npx @ruso-0/nreki` in the README, the CLI help and the `trust-db` hints; the `nreki` bin name is unchanged.
|
|
46
|
+
- Native edit preflight is opt-in (`NREKI_NATIVE_PREFLIGHT=1`). By default NREKI opens no local IPC socket or pipe, writes `.nreki/sessions/<pid>` without a token, preserves large-file `Read` steering, and lets native `Edit`/`MultiEdit`/`Write` pass silently. When `NREKI_NATIVE_PREFLIGHT=1` is set, Claude hook v5 validates native `Edit`/`MultiEdit`/`Write` through authenticated, project-scoped local IPC (including LF edits against CRLF files, newly created TypeScript files matched by `tsconfig.json`, opt-in-only differential TypeScript AST zero-`any` enforcement, and comment-only differential Anti-Sweep suppression checks). Previews never write or auto-heal, skip redundant baseline rebuilds when disk matches memory, restore state quietly under one kernel lock, and preserve pending MCP transactions.
|
|
47
|
+
- Claude Code instructions (`templates/CLAUDE.md`, `templates/SKILL.md`, and MCP initialization instructions) steer single-file edits to native `Edit` and reserve `nreki_code action:"batch_edit"` for cross-file signature changes and renames, while `templates/AGENTS.md` keeps the `batch_edit` + checker workflow for Codex; `context` headers no longer push single-file edits into `batch_edit`.
|
|
48
|
+
- `edit` and `batch_edit` support deleting a symbol via `mode:"replace"` with `new_code:""` (removing the symbol, any immediately attached JSDoc block, and redundant blank separator lines, validated through Layer 1 and Layer 2).
|
|
49
|
+
- TypeScript `.d.ts` declaration surface comparisons strip JSDoc/comments (preserving triple-slash directives), so comment-only edits report `exportedApiUnchanged: true` in both `batch_edit` footers and opt-in preflight; `isAdditiveDeclarationChange` rejects modules with prior `export *` or `export =` so newly added exports cannot silently shadow wildcard re-exports for importers outside the active `tsconfig`.
|
|
50
|
+
- The external-file watcher coalesces queued external changes into one batch semantic refresh, skips TypeScript baseline rebuilds on non-TS changes, invalidates topology on external `unlink`, and tracks ordered internal/Auto-Heal commits so NREKI's own writes never trigger false external reloads.
|
|
51
|
+
- Spanish and hybrid `context` retrieval: `VectorIndex.searchQuery` awaits in-flight initial Voyage syncs (up to 5 s) so cold first-turn `context`/`search` calls fuse dense + BM25 instead of returning 0 query calls, `syncSemanticIndex()` and `VectorIndex` flush `.nreki.db` immediately on completion, and `indexDirectory()` purges stale paths outside watched roots so relocated/copied prewarmed workspaces reuse stored vectors without re-embedding ghost paths. `context` also includes imported helpers/types up to 18 lines (plus 1-line signatures for larger called imports), extracts focused 28-line windows inside >80-line search/occurrence hits, appends `tested by <test>` when >4 importers truncate test files, honors negative imperatives (`Do not read <file>` / `No leas <file>`), and expands `spanish-query` with subscription/proration/refund/waitlist/attendance/timezone terms while `KeywordIndex` preserves code identifiers like `todo`/`todos`.
|
|
52
|
+
- `CognitiveEnforcer` registers resolved qualified foveas on substring `compress focus`, unlocks whole-file density-shield fallbacks, and recognizes methods whose enclosing class was shown verbatim in `context` without unlocking sibling homonyms; dead `.nreki/sessions/<pid>` markers are reaped at startup and `deinit`.
|
|
53
|
+
- `context` precision and single-turn completeness (from the 2026-11-25 Codex A/B/C v2 & v3 series on a 197-file fixture): files a task forbids (`Do not read X` / `No leas X`) are excluded from imported helpers and `imported by` lists as well as direct ranking; search results preserve relevance order instead of sorting alphabetically; a topological pass promotes modules imported by an issue's `#1` hit (or concrete service caller of a small `#1` leaf) to primary whole-file candidates while pruning single-parent downstream wrapper callers and redundant `meetingFile` adapters; primary epicenters up to 135 lines (`1,950` tokens) are shown whole verbatim so ~100–135-line services need no follow-up `compress` turn, while larger (`>135`-line) search/occurrence hits fold guard runs (`requireX(…)`, `assertX(…)`, `if (…) throw`) into `// Lx-Ly: N validation/guard lines omitted` lines; multi-line `import … from` blocks are stripped before `importedHelpers` usage ordering, ubiquitous boilerplate helpers (`≥ 10` importers) are skipped, truncated `imported by` headers stay concise without dangling `tested by` lures, and the Spanish lexical bridge adds warehouse/packaging/availability/dispatch terms. Tests: `tests/context-precision-v3.test.ts`.
|
|
54
|
+
- Vite split `tsconfig` references, `.tsx` AST grammar selection, and linked `node_modules` `Read` support (from the 2026-11-25 Claude Code A/B v2 on a Vite + React/TS project): when a root `tsconfig.json` delegates via `"files": []` + `"references"` to a root-level app config (`tsconfig.app.json`, `tsconfig.web.json`, `tsconfig.src.json`), both `TsCompilerWrapper` and `import-origin` load that config's compiler options (`jsx`, `moduleResolution: "bundler"`, `paths`) and source program while keeping monorepo subpackage references (`./packages/*`) flagged as `outsideProgram`; `semantic-edit` maps `.tsx` to the `tsx` Tree-sitter grammar (`tree-sitter-tsx.wasm`) so JSX elements pass Layer 1 syntax validation in `edit` and `batch_edit`; and `.claude/hooks/nreki-enforcer.mjs` allows `Read` (with normal token-budget steering) on installed dependency files under linked `node_modules/` (`pnpm` stores, workspace links, shared junctions) verified by `package.json` containment while still blocking all writes and symlink escapes (`upgradeEnforcerHook` updates older stock v5 hooks in place). Tests: `tests/vite-tsconfig-and-linked-nm.test.ts`.
|
|
55
|
+
|
|
56
|
+
All notable changes to NREKI will be documented in this file.
|
|
57
|
+
|
|
58
|
+
## [12.1.2] - 2026-11-14
|
|
59
|
+
|
|
60
|
+
Fixes from an external audit of 12.1.1: two security findings (secrets in typed or commented initializers reached the Voyage index; NREKI's own files were written through a `.nreki` link), and three about what NREKI shows or accepts (helpers from another module, a footer that hid importers under another tsconfig, sibling callbacks in the error baseline).
|
|
61
|
+
|
|
62
|
+
### External audit of 12.1.1 at 0d48ca4
|
|
63
|
+
|
|
64
|
+
Five findings, each reproduced first with the auditor's own scripts (run against this tree's build, never against the auditor's evidence). Tests are in `tests/audit-0d48ca4-fixes.test.ts`.
|
|
65
|
+
- It has 28 tests; 27 of them can run on 0d48ca4. The other one tests a function new in this release (the Python/Go import origin).
|
|
66
|
+
- On 0d48ca4, 26 of those 27 fail. The one that passes is a control that must pass on both: inserting a callback before an old error does not block the edit.
|
|
67
|
+
|
|
68
|
+
Security:
|
|
69
|
+
- **The whole value of a secret name is blanked before it leaves for Voyage (P1).**
|
|
70
|
+
- Only the literal right after `=`/`:` was read. `apiKey: string =⏎ "…"` (a type annotation), `= // note⏎ "…"`, `=⏎ /* note */⏎ "…"` and `"a" + // note⏎ "b"` were sent as is; known token shapes already were not.
|
|
71
|
+
- Now the value expression of a secret name is read whole: type annotation, comments, line breaks, concatenations, ternaries, `??` fallbacks, Python parenthesized and triple-quoted strings, Go `var apiKey string =`, PHP `'api_key' =>`, `headers["x-api-key"] =`.
|
|
72
|
+
- It stops at the end of the value: the next statement, the next member, the next argument. `tokens = tokenize("…")` (lexer or model tokens) is not a secret any more; its argument was blanked.
|
|
73
|
+
- **NREKI's own files are never written through a link (P1).**
|
|
74
|
+
- With `.nreki` a link (a directory junction on Windows) to a folder outside the project, `map refresh` rewrote `repo-map.json` there and Chronos rewrote `chronos-history.json`.
|
|
75
|
+
- The same held for pins, `undo` backups, the enforcer state, the transaction log, the `tsbuildinfo` cache, the session marker and the quarantine.
|
|
76
|
+
- Worse: at boot, WAL recovery deleted `.nreki/transactions` recursively, so the folder of that name the link pointed at was deleted.
|
|
77
|
+
- Now every write of NREKI's own files goes through `writeStateFile`. It refuses a linked target or folder, and writes a temporary that cannot already exist (`wx`), then renames it. Caches and history log the refusal. Pins, backups and commits fail with the reason, before writing anything.
|
|
78
|
+
- WAL recovery skips a linked folder and deletes nothing. The quarantine moves and copies nothing through a link (its copy fallback read the target of a linked file).
|
|
79
|
+
- The installed hook is now v4: its state file is never written through a link. Stock v1–v3 hooks are upgraded at server start.
|
|
80
|
+
|
|
81
|
+
Retrieval:
|
|
82
|
+
- **`context` shows an imported helper only from the file that declares it (P2).**
|
|
83
|
+
- Helpers were looked up by name in the whole index, and a single match was accepted whatever its file. `import { calculateFee } from "./public.js"`, a barrel re-exporting `realFee as calculateFee`, or from the package `@vendor/billing`, showed an unrelated `calculateFee` that multiplied by 999.
|
|
84
|
+
- TS/JS specifiers are now resolved as the compiler resolves them (tsconfig `paths`, `.js` → `.ts`, index files), and re-exports are followed. The barrel shows `realFee` "(imported as calculateFee)"; a package shows nothing.
|
|
85
|
+
- Python: the module's file, its package `__init__`, or a module of that package. Go: the package directory under the go.mod module path. Unresolved means no helper (`src/utils/import-origin.ts`).
|
|
86
|
+
|
|
87
|
+
Footers and edit validation:
|
|
88
|
+
- **"Exported API unchanged" no longer hides importers under another tsconfig (P2).**
|
|
89
|
+
- In file mode, with `strict: false`, returning `string | undefined` instead of `string` emits the same `.d.ts`. A consumer compiled by a strict tsconfig broke (TS2322), and NREKI knew it was there, yet the footer said "no other file affected" and "Re-running tsc is redundant".
|
|
90
|
+
- Now the footer names those importers as NOT checked. Project mode now reports them too (tests under another tsconfig, plain JS); it used to say "cross-file" without looking them up.
|
|
91
|
+
- **Sibling anonymous callbacks keep their own errors (P2).**
|
|
92
|
+
- The baseline tied an error to its named declarations only. Two callbacks of a `handlers` array that each declared `count` both read `handlers.count`: fixing the first one's error and adding it to the second was accepted.
|
|
93
|
+
- An anonymous scope now counts as its label and its place among same-label siblings: `it("adds")`, `then()`, `[1]`, `onClick`, `default`.
|
|
94
|
+
- An old error is matched first by the source of its callback, so a callback that only moved, or got a sibling inserted before it, keeps its old error. Moving the body of `it("adds")` into `it("subtracts")`, or copying a broken callback, is a new error.
|
|
95
|
+
|
|
96
|
+
Known and unchanged: the Go/Python (LSP) baseline is still keyed by file + code + message, as its header documents.
|
|
97
|
+
|
|
98
|
+
## [12.1.1] - 2026-11-14
|
|
99
|
+
|
|
100
|
+
`context` finds the code of every issue. Importers are resolved as the compiler resolves them, so footers stay honest. This release also carries the fixes from an external audit: no writes through symbolic links, more sensitive files blocked, and secrets blanked before code is sent to the optional Voyage index.
|
|
101
|
+
|
|
102
|
+
### `context` picks the code of every issue
|
|
103
|
+
|
|
104
|
+
A third Codex holdout measured the published 12.1.0 on another new project (42 files, three pairs, NREKI + Voyage): 360,210 vs 353,730 tokens (+1.83 %), 19 vs 19 turns, all 6 correct, NREKI ahead in 2 of 3 pairs. In two sessions `context` returned none of the 3 files to fix and said "no further read is needed"; the agents then read 5 and 7 files. Causes, from the session logs:
|
|
105
|
+
- **A capitalized word counted as a code name.** "Station settings …" matched a `Station` type, and one code name cancelled the search of every issue.
|
|
106
|
+
- **A paragraph was cut at a `;`.** The three issues were one sentence each; a `;` inside the third split the task in two, so one search covered most of it.
|
|
107
|
+
- **`path:"src"` was ignored.** All three agents passed it, and a plain word ("settings") matched a method of the verifier at the project root.
|
|
108
|
+
|
|
109
|
+
Fixed:
|
|
110
|
+
- **Explicit names only.** A capitalized single word is still looked up, but it no longer names the code of an issue: it stays only when search lands in its file. Backticks, `camelCase`, calls `f()` and `Class.method` are still names.
|
|
111
|
+
- **Every issue that names no code is searched** (top 3 each), even when another issue names its code. A task whose every issue names its code still gets exactly that code, without search.
|
|
112
|
+
- **Sentences before `;`** when a task is split into issues. A negative imperative ("Do not read …", "No leas …") is an instruction, not an issue.
|
|
113
|
+
- **`path` scopes `context`** to a folder or file. An unknown path says the whole project was used.
|
|
114
|
+
- **An issue with no hit is listed:** "no code found for: …".
|
|
115
|
+
- Tests in `tests/context-selection.test.ts`, on a different project (a clinic). Five of the six tests fail on 12.1.0; the sixth checks the unchanged path for named code.
|
|
116
|
+
- **Replay without a model, BM25 only, of the five recorded `context` calls of that holdout:** the 3 target files now in 4 of 5 (before: 1 of 5), 1.7–2.4k tokens each. The Spanish probe still finds 2 of 3: Spanish words against English code remain weak. This was checked on the project that showed the bug; a saving needs a new project.
|
|
117
|
+
|
|
118
|
+
### External audit of 12.1.1
|
|
119
|
+
|
|
120
|
+
Every finding was checked against the code before it was fixed. One of them (F-06) was reproduced, and it showed a different symptom and a deeper defect. Tests are in `tests/audit-12-1-1-fixes.test.ts` and `tests/hook-upgrade.test.ts`. On 12.1.0 they fail, except the one on the new hook-upgrade function, which did not exist then.
|
|
121
|
+
|
|
122
|
+
Security:
|
|
123
|
+
- **No writes through symbolic links (F-01).**
|
|
124
|
+
- At start, the server rewrote `.claude/hooks/nreki-enforcer.mjs` whenever it lacked "cwdPosix". That matched any file, including a hook the user wrote. Through a link shipped in a cloned repository (`-> ~/.bashrc`), it also rewrote a file outside the project.
|
|
125
|
+
- Now only a stock NREKI hook (v1 or v2) is upgraded, and never through a link or a linked folder.
|
|
126
|
+
- `nreki init` and `deinit` skip such targets and say so (`unsafeWriteTarget`).
|
|
127
|
+
- **More files are sensitive (F-02).**
|
|
128
|
+
- Editor configs that start processes: `.vscode`, `.cursor` and `.windsurf` `mcp.json`, `tasks.json` and `launch.json`.
|
|
129
|
+
- Token and key files: `.yarnrc(.yml)`, `id_ecdsa`/`id_dsa`, `.pfx`/`.p12`/`.jks`/`.kdbx`.
|
|
130
|
+
- The patterns now match relative paths (`.npmrc`) too. The compiler host checks the resolved path.
|
|
131
|
+
- **Secrets in ordinary code are blanked before they leave for Voyage (F-12).** That covers private key blocks, well-known token shapes, and the string literals of a line that names a secret. Sensitive paths were already skipped.
|
|
132
|
+
|
|
133
|
+
Footers and edit validation:
|
|
134
|
+
- **Importers come from the compiler (F-03).** In file mode the importers of an edited TypeScript file now include the ones the compiler resolves: tsconfig `paths` aliases, `.mjs`→`.mts`, index files. The import graph only resolved relative paths and `@/`. An importer through an alias was neither type-checked with the edit nor counted, and the footer said "no importers … Re-running tsc is redundant".
|
|
135
|
+
- **Importers outside the program are reported (F-04).** These are importers the tsconfig program does not include, such as tests under another tsconfig or plain JS. The kernel skipped them, yet they were counted as checked. The footer now lists them as NOT checked.
|
|
136
|
+
- **Two more cases never read as fully checked.** An edit that adds or removes files of the program now asks for tsc. So does an edit where auto-heal also patched files outside the edit.
|
|
137
|
+
- **Auto-heal no longer reports a fix it did not make.** An error that neither TypeScript nor an LSP server can fix was dropped, and the edit was reported as "auto-healed" with no fix applied. Examples are a global diagnostic and the cascade limit. Options diagnostics already in the project are now part of the baseline.
|
|
138
|
+
- **The cascade limit counts only errors the edit added (F-06).** In project mode, more than 70 errors already in the project crossed it on any valid edit. The audit said every such edit was then rejected. Reproduced, the edit was accepted with a false "your code had structural errors, NREKI applied fixes" message, and the next edit rebuilt the program from scratch.
|
|
139
|
+
- **A baseline error is tied to its declaration (F-05).** Before, it was keyed by file, code and message only. Fixing an old error in one function and adding the same error in another function of the same file was accepted.
|
|
140
|
+
- **`A.m` and `B.m` of one file in the same batch (F-09).** They now keep separate signature checks; their keys collided. Reading one no longer unlocks a blind replace of the other.
|
|
141
|
+
|
|
142
|
+
`context`:
|
|
143
|
+
- **A named interface or type does not cover its issue (F-07).** The issue is still searched for the code that uses it. A symbol cut to its first line no longer counts as read.
|
|
144
|
+
- **Spanish (F-08).** Negative imperatives are a list of verbs: "No todas las facturas…" was dropped as an instruction. Accents and ñ are folded in task words and in the search index: "Configuración" was cut into "Configuraci" + "n".
|
|
145
|
+
|
|
146
|
+
Turns NREKI cost:
|
|
147
|
+
- **The circuit breaker keeps the compiler error that tripped it (F-11).** For `batch_edit` it now names the batch's first file and symbol instead of "the current file".
|
|
148
|
+
- **Chronos lets a patch through (F-13).** It no longer blocks a `mode:"patch"` edit, which is matched against the current source. The full read it demands no longer costs karma.
|
|
149
|
+
- **Smaller `outline` expansion (F-13).** It shows at most 2,000 tokens of high-risk bodies (was 6,000), and no longer says "MUST run".
|
|
150
|
+
- **Token estimates use `o200k_base` (F-13).** It is the tokenizer of current models and of the token tests.
|
|
151
|
+
- **`definition`, `references` and `prepare_refactor` use the index (F-14).** They no longer re-read the tree. `definition` shows 3 bodies and lists the other locations.
|
|
152
|
+
- **`orphan_oracle` no longer suggests `new_code: null` (F-10).** The schema rejects it.
|
|
153
|
+
|
|
154
|
+
Docs: ARCHITECTURE.md described local ONNX embeddings and RRF with k = 10. Both had been removed in v11/v12; the search section is rewritten.
|
|
155
|
+
|
|
156
|
+
### Measured pair of 2026-11-14 (local 12.1.1)
|
|
157
|
+
|
|
158
|
+
- **Result.** One pair, run by Codex on another new project (ParcelForge, 36 files), with this working tree: plain 760,190 vs NREKI + Voyage 449,645 tokens (−40.85 %), 36 vs 21 turns (subagents included), both correct (22 visible tests and 627 external checks).
|
|
159
|
+
- It is one run per arm, and the agents delegated differently: three subagents in plain, two with NREKI.
|
|
160
|
+
- Voyage made no query. `context` was called with three identifiers, so the saving cannot be attributed to Voyage.
|
|
161
|
+
- **Secrets split across lines reached the text sent to Voyage.** Found by that run's audit. `redactSecrets` worked line by line, so a value on the next line (`apiKey:\n "…"`) or inside a multi-line template password was sent as is. Now:
|
|
162
|
+
- the literal assigned to a secret name is followed across line breaks and `"…" + "…"`;
|
|
163
|
+
- Go `:=`, quoted JSON keys and `"Bearer …"` literals are covered too.
|
|
164
|
+
- Their offline reproduction passes; the previous build leaked 4 of the 6 regression cases.
|
|
165
|
+
- **The short imported definitions are shared among the symbols shown.** `context` returned the three named functions, but the cap of 10 definitions went file by file. The first two files' types took it all, so `coveredGrams` (3 lines, the third bug) was not shown and the agent read it natively. Now:
|
|
166
|
+
- the definitions are handed out one round at a time across symbols, called functions first, in call order;
|
|
167
|
+
- the cap is 12.
|
|
168
|
+
- Replayed on that project, the definition is shown. That replay is on the measured project, so it is a check, not a measurement.
|
|
169
|
+
- **Real-gopls tests skip when `go` cannot run.** A Windows application-control policy blocked `go.exe` on this machine while it still resolved on PATH. NREKI itself reported it correctly: "go validation failed (no views)", and a syntax-only footer.
|
|
170
|
+
|
|
171
|
+
## [12.1.0] - 2026-11-13
|
|
172
|
+
|
|
173
|
+
Security and integrity fixes from the external audits of v12.0.0. Go/Python edits are now checked against their importers. The token cost was reworked and measured with Codex: the `context` action, smaller tool definitions and results, `Class.method` names, an optional Voyage index, and a footer that says when re-running tsc is redundant. **v11.4.2 (`latest`) shares the SEC-01, SEC-02 and SEC-03 code paths and needs the same backport.**
|
|
174
|
+
|
|
175
|
+
### Security
|
|
176
|
+
|
|
177
|
+
- **SEC-01 — WAL recovery is jailed.** `boot()` replayed `.nreki/transactions/wal.json` with raw `renameSync`/`unlinkSync`; a cloned repo shipping a WAL could delete or overwrite files outside the project (and `.git/hooks/*`) on the first edit. Entries are now validated (`safePath` + realpath, no sensitive/`.git`/`.nreki` targets, backups must be `<8hex>.bak` regular files inside the transactions dir). Recovery runs before the TS program is built, and a WAL owned by another live NREKI process (new `pid` field) is left alone.
|
|
178
|
+
- **SEC-02 — Auto-heal write jail.** TS CodeFixes and LSP WorkspaceEdits could write outside the project (tsconfig includes, symlinked dirs) or into `.env`, `.git/hooks`, `.claude/settings.json`. Every heal target now goes through `safePath` and may not live under `node_modules`/`.git`/`.nreki`; `commitToDisk()` re-checks every target.
|
|
179
|
+
- **SEC-03 — No binaries from the repository (Windows).** Verified empirically: both `cmd.exe` and libuv search the cwd before PATH. The basedpyright probe ran `spawnSync("basedpyright --version", {shell:true})` at **server start** with the full `process.env`. Sidecar binaries are now resolved to absolute paths from trusted PATH entries only (never the cwd, relative entries or in-project `node_modules/.bin`); `.cmd` shims run through an absolute System32 `cmd.exe`; children get `NoDefaultCurrentDirectoryInExePath=1`. The probe no longer executes anything.
|
|
180
|
+
- **SEC-04 — Enforcer hook v3.** Resolves symlinks (a project path whose real location is outside the project is blocked) and fails open when no NREKI server is alive (server writes `.nreki/sessions/<pid>`). Rewritten around token cost: a PreToolUse hook runs after the model has generated the call, so blocking Write/Edit never saved tokens, it only added turns.
|
|
181
|
+
- Native Edit/MultiEdit/Write are allowed; `NREKI_ENFORCE_EDITS=1` restores the redirect to validated edits for code files of 100+ lines.
|
|
182
|
+
- Only whole-range Reads of big code files (~6k+ tokens, `NREKI_READ_MAX_TOKENS`) are blocked, once, and the message carries the file's symbol outline with line ranges, so the retry is one targeted Read; repeating the same Read is allowed. `offset`/`limit` are honored (v1/v2 blocked a 40-line read of a big file).
|
|
183
|
+
- Non-code files (`.md`, `.json`, images, PDFs) and paths outside the project (Claude Code memory, plans, scratch files, which v2 rejected as "path traversal") are left alone.
|
|
184
|
+
- Stock v1/v2 hooks are auto-upgraded; customized hooks are left alone.
|
|
185
|
+
- **SEC-05** — `getScriptSnapshot`/`fileExists` honor `isSensitivePath()` like `readFile` already did.
|
|
186
|
+
- **SEC-06 — Signed memory files.** `.nreki.db` (engrams, `memorize` scratchpad, plan pointer, index, vectors), `.nreki/pins.json`, `.nreki/chronos-history.json` and `.nreki/repo-map.json` live in the project, and the agent receives parts of them as its own notes: engrams in outline/search, pins in every `map`, and the scratchpad and plan in the periodic memory payload. A cloned repository (or an archive, which keeps mtimes) could ship them to plant instructions.
|
|
187
|
+
- Each file is now signed with HMAC-SHA256 under a per-user key in `~/.nreki/trust.key` (created atomically, mode 0600; `NREKI_TRUST_DIR` overrides it).
|
|
188
|
+
- An unsigned or foreign file is never read. It is moved to `.nreki/quarantine/`; the map cache is simply regenerated.
|
|
189
|
+
- `npx @ruso-0/nreki trust-db` lists what was quarantined and restores engrams, notes, plan and pins after the user types `yes`. It requires an interactive terminal and no running NREKI server, so an agent's shell tool cannot trigger it.
|
|
190
|
+
- Upgrading from ≤ 12.0.0 quarantines existing memory once.
|
|
191
|
+
- `audit` reads the session count from the verified history instead of the raw file.
|
|
192
|
+
|
|
193
|
+
### Integrity
|
|
194
|
+
|
|
195
|
+
- **INT-01 — Phantom commit.** "Ignore node_modules errors" ran after the kernel had already rolled back, so NREKI answered `[OK]` while writing zero bytes (and root-level `node_modules` errors were not even matched). Third-party diagnostics are now filtered inside the compiler wrapper, before the verdict.
|
|
196
|
+
- **INT-02 — Stale hologram shadows.** `commitToDisk()` now invalidates shadows/pruning/JIT cache for committed files (root cause of the unreproduced "hologram scope mismatch").
|
|
197
|
+
- **INT-03 — TOCTOU.** Commits abort with `NrekiConflictError` (nothing written) if a file changed on disk while the edit was being validated — kernel and syntax-only paths. The WAL is now mandatory.
|
|
198
|
+
- **INT-04 — LSP URIs.** RFC 8089 encoding via `pathToFileURL` and canonical decoded keys: paths with spaces, `ñ` or `%3A` drive letters no longer drop every diagnostic or break auto-heal paths. A failed pull-diagnostics request is reported instead of returning zero errors.
|
|
199
|
+
- **INT-05 — Undo.** Atomic restore (backup kept until the rename succeeds), file lock, and kernel re-sync (`notifyExternalChange`: VFS, LanguageService version, baseline, shadows, LSP overlays). A backup that cannot capture the current state is dropped so undo never restores a version from two edits ago.
|
|
200
|
+
- **INT-06** — File mode now type-checks direct importers (≤ 50); hologram `batch_edit` blocks signature changes with > 50 importers outside the batch (mirrors `edit`). Windows path normalization fixed in batch dependent lookups.
|
|
201
|
+
- **INT-07** — CRLF preserved on `replace`/`insert_*`; BOM and permission bits preserved on every write; invalid UTF-8 / UTF-16 files are refused instead of corrupted; `getLspOffset` clamps per LSP spec.
|
|
202
|
+
|
|
203
|
+
### Honest guarantees
|
|
204
|
+
|
|
205
|
+
- **GAR-01** — The constant `[Validated: AST + Semantic check passed. Do not run bash verification.]` is replaced by a footer stating what actually ran (syntax only / TS project-wide / edited file + N importers / LSP offline / no checker for the language).
|
|
206
|
+
- **GAR-02** — `batch_edit` now shows auto-heal notices (incl. collateral files), sidecar warnings and Python/Go TTRD alerts.
|
|
207
|
+
- **GAR-03** — Anti-Sweep is differential and language-aware: blocks newly added `@ts-ignore`/`@ts-nocheck`/`@ts-expect-error`, blanket or React-rule `eslint-disable`, `# type: ignore`, `# pyright: ignore`, `# noqa`; legacy suppressions no longer block unrelated edits.
|
|
208
|
+
- **GAR-04** — `fixMissingProperties` removed from auto-heal (it fabricated `0`/`""`/`false`/throw stubs); auto-import only when the candidate module is unique (`fs` ≡ `node:fs`); LSP heal accepts import actions only.
|
|
209
|
+
|
|
210
|
+
### Compressor (measured: 10 real files, 30 questions answerable from the code)
|
|
211
|
+
|
|
212
|
+
- **Comment stripping is AST-exact.** The regex stage (`/\/\/[^\n]*/`, `/\/\*[\s\S]*?\*\//`) did not know about strings: it cut `"https://…"`, turned `startsWith("//")` into `startsWith("")`, emptied template literals, deleted whole lines between the `/*` of one glob string and the `*/` of another, broke `url(http://…)` in CSS and every Markdown URL, and replaced every Python triple-quoted string (even `SQL = """…"""`). Noise is now located with tree-sitter (`findNoiseRanges`): comments, docstrings/bare string statements, `debugger`, statement-level `console.*`/`print`. Files without a grammar are left untouched.
|
|
213
|
+
- **Stage 2 token filtering is no longer applied.** It removed words like "never"/"before"/"otherwise" ("the file is never written" → "file written") and emitted lines that do not exist in the file; for code its output was discarded by the structural stage anyway. When a skeleton is not shorter than the code, the code is returned verbatim. `scoreTokens`/`filterTokens` were then removed (see "Follow-up review" below).
|
|
214
|
+
- **`read` is verbatim by default.** It used to return the medium skeleton (signatures + ≤ 5 key lines per symbol): 75 % fewer tokens but only 11/30 questions answerable. Skeletons are opt-in (`compress:true`, `level`) and every compressed header now states what was omitted and reports the saving in tokens, not characters. The > 12k-token AUTO-SHIELD is unchanged and labeled as not verbatim.
|
|
215
|
+
- After: medium/aggressive show 0 lines that are not in the source (were 46/113); light answers 30/30; default `read` answers 25/30 (the misses are the auto-shielded > 12k-token files).
|
|
216
|
+
|
|
217
|
+
### Robustness / packaging / docs
|
|
218
|
+
|
|
219
|
+
- `read`/`compress`/`undo`/`filter_output` errors carry `isError: true` (the circuit breaker was blind to them); `getScriptVersion` is monotonic across commits; `batch_edit` no longer edits a differently-cased symbol silently and rejects the same file under two spellings.
|
|
220
|
+
- `nreki init --force` replaced the **whole** user `CLAUDE.md`/`AGENTS.md`/`copilot-instructions.md`; it now rewrites only the NREKI block (sentinel-delimited from now on). The skill installs to `.claude/skills/nreki-optimizer/SKILL.md` (the repo-root copy was never loaded by Claude Code).
|
|
221
|
+
- `tiktoken` pinned; `csv-parse` moved to devDependencies (eval scripts only). Docs: patch threshold is 100 lines (not 40), `fast_grep` is RAM-resident (not SQLite), verification guidance follows the new footer.
|
|
222
|
+
|
|
223
|
+
### Retrieval & Token Efficiency (`fast_grep`, `search`, `map`)
|
|
224
|
+
|
|
225
|
+
- **`fast_grep` 100% lexical coverage & overlap deduplication.** `IndexPipeline.indexAstChunks` previously dropped every line outside captured AST declarations (imports, re-exports, file headers, JSDoc blocks, and top-level calls such as `server.tool(...)` or `describe(...)`), and `walkDirectory` indexed `scripts/` and `package-lock.json` before `src/`. Uncovered line ranges are now indexed as `top_level` chunks (with real character offsets), primary source directories are walked first, lockfiles/repomix dumps are ignored, and `handleFastGrep` deduplicates overlapping `class` vs `method` chunks per `(file, line)` (attributing each hit to the innermost symbol) in a 1-line compact format. Measured against ripgrep on the same corpus (15 queries, 752 lines): index recall 25% → 100%, 0 duplicate and 0 false lines.
|
|
226
|
+
- **`fast_grep` output cap.** Raising the default scan to 200 chunks made broad queries (`"const "`, `"return "`) print 10–20k tokens. Output is now capped at 120 lines (≈3–4k tokens), production code first; the remaining hits are listed per file, and an explicit `limit` (≤ 500) raises the cap. 13/15 benchmark queries are shown in full; the two broadest (161 and 366 hits) are capped.
|
|
227
|
+
- **`search` (BM25 + Tectonic Relevance Scoring) conceptual recall & token compaction.** Fixed unreachable `PorterStemmer` in `KeywordIndex.tokenize` (`codeTokenize` returned non-empty arrays for all words, bypassing `this.stem()`), added question stopwords and multi-term coordination boosting, indexed file path segments + leading file/JSDoc comments + body tokens in `NrekiDB.buildKeywordIndexText`, calibrated `SearchEngine` gravity/blast-radius weights with per-file diminishing returns, and compacted `handleSearch` default output. Measured on 14 **held-out** conceptual questions about modules the change was not tuned on: `hit@5` 7 → 10/14, `hit@1` 3 → 4/14, response tokens 840 → 431. (The 14 questions used during tuning reach 14/14 and 13/14, partly because header comments were added to the target files; that number overstates real-world recall.)
|
|
228
|
+
- **Index persistence.** The comment text used for BM25 (`context_comment`) is now stored with each chunk; before, a restarted server rebuilt a weaker index than a fresh one (held-out `hit@5` 10 → 8/14 after restart). The BM25 index is built lazily on the first `search` (server reopen 582 → 28 ms; the first search after a restart pays ≈0.9 s once). `PARSER_SCHEMA_VERSION` 5 forces a one-time re-index so 12.0.0 databases pick up `top_level` chunks; that wipe now also clears `symbol_io`, whose rows would otherwise attach to the unrelated chunks that reuse the reset ids. Path boosts (`src/` up, `tests/`/`scripts/` down) are computed relative to the project root, so a root such as `~/test/app` no longer puts every file in the same bucket.
|
|
229
|
+
- **A reopened index is reconciled with the disk before it answers.** What changed while the server was stopped is re-read before the first `search` or `fast_grep`. Changed bodies and line numbers are updated, added files are indexed, and deleted files and files now under an ignored directory are dropped. Unchanged files are skipped by hash, and concurrent lookups share one reconciliation. While it runs in the background, an MCP lookup answers "pending" instead of stale code. A failed refresh is not marked fresh and is retried. Tests in `tests/index-freshness.test.ts`.
|
|
230
|
+
- **Optional Voyage AI semantic index (BYOK, off by default).** Requires `NREKI_SEMANTIC=voyage` plus `NREKI_VOYAGE_API_KEY` (or `VOYAGE_API_KEY`): a key exported for another tool does not enable it. Every chunk is embedded once in the background (`input_type: "document"`, batches of ≤ 64 texts / ~60k tokens, 429/5xx retried with backoff, invalid key stops and logs once), quantized to int8 and stored in `.nreki.db` keyed by the hash of its text, so restarts and unchanged chunks cost no API call. Search sends only the query and fuses the dense ranking with BM25 by reciprocal-rank fusion, so chunks that share no words with the question can surface (the earlier draft only reranked BM25 candidates and re-sent ~50 code snippets per search). Sensitive paths are never sent; `NREKI_VOYAGE_MAX_TOKENS` caps the embedding spend per process. Tested with a mocked API; recall on real code not measured yet. See README › Privacy.
|
|
231
|
+
- **Engrams.**
|
|
232
|
+
- Identity is the qualified symbol (`Class.method`; Go `Receiver.method`) plus the body hash. Before, with two `run` methods in one file, a note meant for the second landed on the first, and the next `outline` deleted it as "code mutated" without any change. A bare name that is ambiguous is now rejected with the qualified candidates; old bare-name engrams are moved to the symbol whose body matches.
|
|
233
|
+
- Keys are project-relative canonical paths, so `d:\x` vs `D:\X` or a moved project folder no longer hides them; old absolute keys are migrated at startup.
|
|
234
|
+
- Engrams now also appear under matching `search` results. Text is capped at 500 characters (it is printed on every outline), `ASSERT` detection ignores leading spaces, and a symbol missing from a parse (renamed or mid-edit) no longer deletes its notes.
|
|
235
|
+
- **`map` semantic purpose summaries.** `generateRepoMap` (`CACHE_FORMAT_VERSION = 4`) extracts each file's 1-line header purpose. `depth:"full"` shows it for every file; the default skeleton stays CORE/BRIDGE-only and appends it to those lines (2.6k → 3.6k tokens on NREKI itself; listing every leaf as well cost 8.1k).
|
|
236
|
+
- **Cleanup.** Moved stranded `src/handlers/navigate.test.ts` to `tests/fastgrep-handler.test.ts` and removed unused `src/kernel/backends/ts-corsa-sidecar.ts`.
|
|
237
|
+
|
|
238
|
+
### External audit of the 12.1.0 tree (Fable 5.2)
|
|
239
|
+
|
|
240
|
+
Each finding was traced against the code before fixing; regression tests in `tests/audit-fable-fixes.test.ts`, `tests/engram-identity.test.ts`.
|
|
241
|
+
|
|
242
|
+
- **S-01 — The index applies the read tools' jail.** `walkDirectory` pushed symlinked files and `indexFile` read anything it was given, so `src/x.ts -> ~/.ssh/id_ed25519` (or a file reached through a junction) was indexed and served by `fast_grep`/`search`, and embedded to Voyage when enabled. Symlinks, sensitive paths and real locations outside the project are now skipped by the indexer, `ast-navigator` and `repo-map` walkers; the watcher no longer follows symlinks.
|
|
243
|
+
- **S-02 — Memory is signed by content.** The DB owner tag signed a random id, so a leaked signed `.nreki.db` could carry planted engrams. A second HMAC now covers every engram plus the `memorize` notes and plan pointer, re-signed on each NREKI write. It is deliberately not bound to the project path, so moving a project keeps its engrams.
|
|
244
|
+
- **S-03 — `trust-db` hardening.** The preview showed truncated text and passed terminal control sequences through. It now shows everything with control characters made visible. Adoption applies the same rules as the normal tools: pin length, blocked patterns, escaping, and no control characters or line breaks (this rule now applies to `addPin` too); engram size cap; scratchpad cap; plan pointer inside the project. Rejected items are listed.
|
|
245
|
+
- **S-04** — `.nreki/enforcer-state.json` is signed like the other state files; a planted one is quarantined.
|
|
246
|
+
- **I-01** — After an aborted commit (conflict / OS error) and after `rollbackAll`, gopls/pyright receive the disk content again instead of keeping the approved-but-uncommitted overlay.
|
|
247
|
+
- **I-02 — Two NREKI servers on one project.** `save()` wrote the whole in-RAM DB, so the last writer erased the other process's engrams, notes and plan. When the file changed since this process last read or wrote it (file id + mtime + size), memory is merged from disk first (only if that file verifies); vectors are unioned.
|
|
248
|
+
- **I-03** — If a commit aborts, the previous `undo` backups are restored, and heals are recorded only after the commit succeeds. Auto-heal no longer rewrites collateral files that are not valid UTF-8 (they would have been written back with U+FFFD).
|
|
249
|
+
- **G-01** — The footer no longer says "cross-file (project mode) … re-running tsc is redundant" for a file the tsconfig does not select (excluded, or a solution-style root config with `files: []` + `references`). It now says the file was checked in isolation and importers were not.
|
|
250
|
+
- **G-02** — The `search` description, the startup log and README said `search` was "Type Ledger semantic" and that BM25 was removed; it is BM25 + topology (plus the optional Voyage index). ARCHITECTURE.md module tables were refreshed: no `embedder.ts`/`preToolUse.ts`/`clear_pins`, and test-only modules are marked as such.
|
|
251
|
+
- **G-03** — "Tokens saved" by `search` no longer multiplies by an invented ×5 and is 0 with `include_raw`. USD estimates use current list prices (Sonnet 5.5 $2/M, Opus 5.5 $4/M input; Opus was priced at $15/M). The report's two sections are separated.
|
|
252
|
+
- **C-01 — `read` was unreachable through MCP.** The cognitive enforcer blocked every `read` and every `compress` without `focus` on 100+ line code files, so the verbatim-read contract never ran and each block cost 1–2 turns. Both rules are gone (`handleRead` already AUTO-SHIELDs files above 12k tokens). A verbatim read now counts as having seen the file for the blind-edit rule.
|
|
253
|
+
- **T-01** — Symbols that `outline` auto-expands count as seen, so editing them no longer demands a second read of the same code.
|
|
254
|
+
- **C-02** — Chunks store their qualified name (`qualified_name`, `PARSER_SCHEMA_VERSION` 6): `search` matches engrams exactly, keeps `ASSERT` engrams on methods after body edits, and never shows one on a same-named twin.
|
|
255
|
+
- **C-03** — `fast_grep` spends its chunk limit on production code first; a re-indexed `src/` file sits at the cache tail and could be cut off behind test noise.
|
|
256
|
+
- **T-02** — The context heartbeat measured drift as input + output, which handlers log as the same number, so it fired at half the threshold. Internal development notes were removed from tool descriptions, which are paid on every turn.
|
|
257
|
+
- **Tests** — Chronos GC test 11 passed only because the unsigned file was quarantined; it now re-signs and proves a high-CFI sibling survives. The breaker TTL test now actually advances time. `phantom-scalpel` test 11 was `expect(true).toBe(true)` and now drives `handleRead`. `database-symbol-io` passed a v10 `Float32Array` as `startIndex`.
|
|
258
|
+
|
|
259
|
+
### Follow-up review of the audit fixes
|
|
260
|
+
|
|
261
|
+
A second audit re-checked the fixes above; S-01…S-04, I-03, G-01, C-02 and C-03 held. Regression tests in `tests/audit-fix-review.test.ts` (each fails on the previous code).
|
|
262
|
+
|
|
263
|
+
- **I-01 (again) — No empty LSP overlay outlives a rollback.** A null "tombstone" kept the document open with empty text. gopls reports an empty buffer as a syntax error (`expected ';', found 'EOF'`, verified on v0.24.0) and errors of every open document are collected, so one phantom file failed every later Go edit. In pyright an empty overlay of a file that exists hides its symbols from importers (`"x" is unknown import symbol`); a buffer of a file absent on disk is not importable, so that case was harmless there (the audit claimed the opposite; verified on 1.1.414). It came from two paths: a rolled-back LSP auto-heal sent `null` for collateral files that exist on disk (now their disk content is sent), and a resync of a file absent on disk (now `didClose`). The audit's own scenario, a `batch_edit` creating a new file, cannot happen: edits only target existing files.
|
|
264
|
+
- **I-02 (again) — Engram merge is per key.** One dirty flag kept every local row when merging: an engram deleted here came back when the other server had written meanwhile, and the other server's newer update or deletion of a key this server never touched was overwritten. The merge now adopts the disk table and replays only the keys changed here, inside a savepoint (a failed merge no longer reaches disk half-applied).
|
|
265
|
+
- **T-01 (again)** — Verbatim `read` (and `compress` of files under 100 lines) did not log usage, so after C-01 most file content never counted toward the heartbeat drift or context pressure.
|
|
266
|
+
- **T-02 (again)** — `set_plan` stored input + output as the last drift while the heartbeat compares output only, so the next safe call reset it and fired at once.
|
|
267
|
+
- **Dead code removed:** `middleware/validator.ts`, `hologram/harvester.ts`, `hologram/shadow-cache.ts`, `NrekiDB.fastGrepSQLite`/`logUsage`/`searchRawCodeLike`, `NrekiEngine.searchRawCodeLike`, `ReactEslintSidecar.checkAntiSweep` (the live Anti-Sweep is `utils/suppression-guard.ts`; its comma-list case was moved there) and `scoreTokens`/`filterTokens` with their tables. Tests that only covered them were removed.
|
|
268
|
+
- **`tests/` type-check clean:** 23 → 0 errors (stale mocks; `fiedler` is `undefined` above 25,000 nodes, so the benchmark scripts now print `n/a` instead of throwing). The eval console report printed `-Inf`/`NaNms` for token p99 and mean latency, which the aggregate never computed.
|
|
269
|
+
|
|
270
|
+
### Go/Python: only the errors an edit adds are fatal
|
|
271
|
+
|
|
272
|
+
Found while reviewing I-01; regression tests in `tests/lsp-error-baseline.test.ts`.
|
|
273
|
+
|
|
274
|
+
- gopls/pyright report the errors of every open document, and all of them rejected the edit. One error that was already there, in the edited file or in any file opened by an earlier edit, blocked every later Go/Python edit. TypeScript already compared against a fingerprint baseline; LSP errors did not.
|
|
275
|
+
- The kernel now takes a per-transaction baseline (errors of the open documents at their pre-edit content) and rejects only fingerprints (`file`, `code`, `message`) that occur more often after the edit. Errors the edit causes in other open documents are still caught. LSP auto-heal is judged on the same baseline.
|
|
276
|
+
- Cost: one extra diagnostics round the first time a file is edited; nothing when it is already open at its pre-edit content. A baseline is never read from diagnostics left by a failed pull round.
|
|
277
|
+
- Same limit as for TypeScript: replacing an error by another with the same file, code and message is not reported. The footer says `(new errors only)`.
|
|
278
|
+
- Verified against the real servers, gopls v0.24.0 and pyright 1.1.414 (`tests/lsp-real-gopls.test.ts`, `tests/lsp-real-pyright.test.ts`; each runs only when its binary is on PATH and is skipped otherwise): an old error no longer blocks, added errors and cross-file breaks are rejected with only the new error listed, and gopls' "Add import" auto-heal succeeds in a file that already had an error. Stress runs of 50 (gopls) and 75 (pyright) back-to-back edits showed no false approval or rejection. basedpyright was not tested.
|
|
279
|
+
|
|
280
|
+
### Edit latency: pull diagnostics, parsed-file cache, an idle TypeScript backend
|
|
281
|
+
|
|
282
|
+
Measured with the kernel driven directly (no MCP round trip). Regression tests in `tests/lsp-sidecar.test.ts` and `tests/ts-host-cache.test.ts`.
|
|
283
|
+
|
|
284
|
+
- **Go/Python diagnostics are pulled.** gopls and pyright both published diagnostics towards NREKI's handshake, so every round waited on a 150 ms settle timer and trusted that nothing arrived later. gopls now gets its `pullDiagnostics` setting and pyright is offered dynamic registration; a server that answers `textDocument/diagnostic` without advertising it is pulled too, and one that answers "method not found" keeps the published path. Real servers, the same 75 back-to-back edits before and after (same-file errors, clean edits, cross-file breaks), no wrong verdict in any run: median per edit 1087 ms → 20 ms (gopls v0.24.0) and 1632 ms → 15 ms (pyright 1.1.414). Part of that gain is the idle TypeScript backend below; basedpyright was not measured.
|
|
285
|
+
- **JSON-RPC: a request from the server is no longer taken for a response.** Any message whose id matched a pending request resolved it, but servers send their own requests (`client/registerCapability`, `workspace/diagnostic/refresh`…) numbered from the same small integers. A pending pull was then resolved with `undefined`: zero diagnostics, the edit passed. Messages with a `method` are now never responses, and server requests are answered (pyright waits for the answer before serving pulls).
|
|
286
|
+
- **TypeScript: parsed files are kept across program builds.** The stock incremental host re-read and re-parsed every file for each new program, at least twice per accepted edit. A file is now parsed again only when the text the host reads (VFS first, then disk) differs from the text it was parsed from, so the result is exact, with no mtime or version counter. Median per edit of one file: 825 → 177 ms (48 files, file mode), 791 → 341 ms (48, project mode), 3431 → 1108 ms (400, file mode), 4383 → 2671 ms (400, project mode). What remains in project mode is the full re-check when the baseline is captured at commit.
|
|
287
|
+
- **TypeScript: two answers that outlived the file system.** The same stock host caches every `fileExists()` answer and the text of every `.json` file for its whole life (it is built for one compilation). A module created after a failed import stayed `TS2307 Cannot find module` until the server restarted, and a JSON module edited through NREKI was type-checked against its first content. Both now read through to disk.
|
|
288
|
+
- **Go/Python-only projects: the TypeScript backend is idle.** Without a tsconfig and with no root files, TypeScript still loaded every `@types` package visible from the working directory on alternate builds (121 files in the measured setup): 489 ms → 6 ms per `.py` edit with `types: []` in the fallback options.
|
|
289
|
+
|
|
290
|
+
### Found by driving the built server over MCP
|
|
291
|
+
|
|
292
|
+
`dist/index.js` was driven with the official MCP client on throwaway TypeScript, Go and Python projects. Regression tests in `tests/mcp-drive-fixes.test.ts` and `tests/lsp-dependents.test.ts` (each failed on the previous code) and in the real-server tests.
|
|
293
|
+
|
|
294
|
+
- **Python `replace`/`insert_*` kept the body out of its block.** The payload was re-indented on "the shallowest line after the first marks the symbol's level", which is the closing brace in TS/Go. Python has none, so the body landed on the `def`'s column and every full replace of a Python function was rejected with an error the agent did not write ("expected an indented block"), whatever indentation it sent. The level now comes from the block structure (decorators, multi-line signatures, brackets, triple-quoted strings): relative, absolute and first-line-trimmed payloads give the same file.
|
|
295
|
+
- **`batch_edit` indents a nested symbol like `edit`.** `replace`/`insert_*` in a batch were spliced into the detached chunk text, where the indentation around the symbol is unknown: a method's new lines went to column 0 (misformatted in TS/Go, outside the class in Python). They are spliced into the file now; `patch` is unchanged.
|
|
296
|
+
- **Layer 1 rejects a Python block without a body.** tree-sitter-python parses `def f():` followed by a line on the same column as an empty block with no error node, so that code passed the syntax check and, without a Python LSP, reached disk. An empty block is now `MISSING(indented block)`.
|
|
297
|
+
- **Go/Python: an edit is checked against the files that depend on it.** gopls/pyright report open documents only, and only the edited files were open: `Greet` changed to return `int` was accepted while `main.go` (same package) no longer compiled, and the same happened with an importer in another Go package and with `app.py`. Push mode (before pull diagnostics) behaved the same. Before taking the baseline, the kernel now opens the other files of the edited file's Go package and its importers (dependency graph, in every mode), at most 50 per edit. Open documents follow their disk content, and at most 96 stay open (least recently used are closed). gopls v0.24.0 / pyright 1.1.414, median of 15 edits after the first: Go 10 ms with nothing opened (the breaking edit was accepted) → 25 ms with 15 dependents → 71 ms at the cap; Python 12 → 18 ms (10 importers) → 31 ms (50). The first edit pays 0.3–1.8 s once (server start, package load).
|
|
298
|
+
- **The dependency graph resolves Go and Python imports.** A Go import names a package (module path + directory). It resolved to no file, or to a file that only shared the package's name, so Go files had no importers and an empty blast radius. Python relative imports (`from .x import y`, `from .. import z`), `from pkg import module`, packages (`__init__.py`), imports inside functions, `import a, b` and imports rooted in a subdirectory (`backend/app/…`) did not resolve. `CACHE_FORMAT_VERSION` 5 rebuilds the map once.
|
|
299
|
+
- **Footer.** "LSP diagnostics on open files" named a set the agent cannot know. It now reads `<lang> LSP diagnostics on the edited file(s) + N dependent file(s) (same package / importers) (new errors only)` and says how many dependents the cap left out, or that importers could not be looked up.
|
|
300
|
+
- **`type_shape` answered `any` for values.** Functions, consts and classes went through `getDeclaredTypeOfSymbol`, which only applies to types, so `total` came back as `type total = any`: a false contract. It now prints the declaration as the checker resolves it (`function total(items: number[]): number`, `const LIMIT: 5`, `class Box { … }` with its public members, `interface`, `type`, `enum`). Called before the first edit, it boots the kernel instead of answering "kernel not booted… retry".
|
|
301
|
+
- **`batch_edit` has `edit`'s small-file bypass.** On a 7-line file `edit` went through but `batch_edit` demanded a `compress focus` first, one extra turn on the path AGENTS.md prescribes. Both share the rule now, and a file of 50 KB or more with few lines (minified, generated) no longer counts as small.
|
|
302
|
+
- **A `tsconfig.json`/`jsconfig.json` turns type checking on at any size.** TypeScript projects under 50 TS/JS files ran syntax-only: in a 4-file project an edit that broke its importer was written to disk. The threshold dates from when a file-mode check cost seconds; it is ~0.4–0.5 s per edit through MCP now.
|
|
303
|
+
- **Bounded rejections.** Every error was listed: one signature change breaking 56 importers answered 56 near-identical lines (~1,200 tokens) on every retry. The first 12 errors are listed (edited files first) and the rest is summarised by code and file (~435 tokens there); a single diagnostic is clipped at 600 characters.
|
|
304
|
+
- **BLAST RADIUS names only what nobody checked.** It listed every importer and said "Fix dependents via batch_edit", also when the kernel had just type-checked them with the edit, which invites "fixing" files that compile. Checked importers are counted; unchecked ones are listed, up to 15.
|
|
305
|
+
|
|
306
|
+
### Token cost: what an agent pays for using NREKI
|
|
307
|
+
|
|
308
|
+
A Codex A/B on 2026-11-13 (same model and effort, three tasks, 18/18 checks passed by both arms) measured NREKI at **+24.86 %** tokens: 164,675 vs 131,891. Its session logs show where they went. Both arms made 6 requests, and each request re-sends the whole conversation. The NREKI arm's tool results totalled 11,296 tokens vs 3,005 and were paid again on every later request: the tool schemas fetched through the HTTP bridge (3,491), a `map depth:"full"` (2,457), ~150 tokens of banners around each `compress` body, and edit footers. Both arms also paid the repository's AGENTS.md (1,221 tokens) on every request. Measured below by replaying the same NREKI calls on the benchmark's fixtures (tokenizer o200k_base); tests in `tests/token-economy.test.ts`.
|
|
309
|
+
|
|
310
|
+
- **`nreki_navigate action:"context"`** (new). Pass the task text and get back, in one call and within `token_budget` (default 2,000), the symbols it names verbatim with path and line range, where the fields it mentions occur, and who imports each file. When it names no symbol, the code holding the fields it mentions; when it names neither, the best `search` hits (BM25, fused with Voyage when enabled). What it shows counts as read for the blind-edit rule. On the A/B task text it returns exactly the four symbols to edit in 239 tokens, where the NREKI arm spent 3,146 tokens over two turns (`map`, `read`, three `compress`, `prepare_refactor`).
|
|
311
|
+
- **Tool schemas 2,080 → 1,077 tokens per request.** Same tools, actions and parameters; descriptions cut to what selects a call. The dead `walk_depth` parameter of `nreki_code` (only 1 was supported) was removed.
|
|
312
|
+
- **`compress focus` 234–261 → 70–92 tokens** on the benchmark symbols: one header line, then the code with its line range, importers and callers. The banners are gone (TFC-Pro statistics, TOPOLOGICAL LAYOUT, TFC METADATA, FOVEA). A short interface or type from another file is shown whole: its stored shorthand printed `interface Invoice { }`, which reads as an empty type. A focus that is most of the file returns the file instead of an error that cost another call. An unknown focus lists the file's symbols, the closest first, instead of sending the agent to `outline`.
|
|
313
|
+
- **`map depth:"full"` 2,127 → 1,282 tokens.** JSON/CSS/HTML files no longer get fake signatures (`class: "type":"module"`). An export already named by a signature line is not listed again. Signatures are capped at 15 per file, and the hidden ones keep their names.
|
|
314
|
+
- **Smaller results elsewhere.** Edits: no `[ZERO-CHATTER…]` line, POSIX separators in the file list. `prepare_refactor`: project-relative paths (absolute Windows paths were ~3× longer and doubled by JSON escaping).
|
|
315
|
+
- **Instruction files.** templates/AGENTS.md 556 → 459, CLAUDE.md 813 → 476, SKILL.md 1,415 → 691 tokens, and the repository's own AGENTS.md 1,221 → 459. They now start with `context`, keep the rules that change behaviour, and drop the marketing and the bans on native reads that made agents pay more for the same answer.
|
|
316
|
+
- **Re-measured: still +25.49 %.** Three pairs with native MCP followed (Codex CLI, `context` available, both arms 18/18): 414,330 vs 330,174 tokens. The session logs show why:
|
|
317
|
+
- `read` ignored `focus` and returned four whole files (4,764 tokens; the four bodies are ~300).
|
|
318
|
+
- Agents printed NREKI's tool definitions to learn the calls (Codex code mode, ~1k tokens, once twice).
|
|
319
|
+
- They re-read the symbols `context` had just returned, and re-read AGENTS.md, one extra turn each (~20k tokens re-sent). The common AGENTS.md of that run said "begin with context, then use NREKI reads".
|
|
320
|
+
- The first request of both arms was the same size: in that mode the definitions are not paid per request.
|
|
321
|
+
- **`read` honours `focus`.** It returns those symbols, as `compress focus` does, and counts them as read for the blind-edit rule. The four reads of that run cost 304 tokens instead of 4,764.
|
|
322
|
+
- **`compress focus` on a small file returns the symbol.** The < 100-line bypass returned the whole file: 17 lines for a 4-line `clamp`. A focus that is most of the file still gets the file.
|
|
323
|
+
- **`context` says the bodies are complete:** "current and complete code; edit it with batch_edit by these symbol names, no further read is needed". If a symbol was cut by the line or token limit, it says so instead.
|
|
324
|
+
- **Voyage on an account without a payment method embedded nothing.** Voyage limits such accounts to 3 requests and 10K tokens per minute. Every 60K-token batch was refused (429), the index gave up after six tries, and the warning gave no reason, so search silently stayed BM25-only (verified with a real key: 0 of 1,507 chunks after 67 s). The 429 detail is now parsed. Batches shrink to 80 % of the stated tokens per minute (a batch that does not fit is halved), requests are paced, a query that would exceed the minute's quota answers from BM25 instead of spending a request, and the log states the limit and the expected time. Tests in `tests/voyage-vector-index.test.ts`.
|
|
325
|
+
- **Tool definitions 1,077 → 700 tokens.** Only everyday parameters are declared. The advanced ones (`depth`, `type_name`, `level`, `compress`, `token_budget`, `_nreki_bypass`, …) are still accepted, validated by the handlers and named in the descriptions.
|
|
326
|
+
- **Pre-registered A/B with Voyage: a tie.** 3 pairs, Codex, a 40-file TypeScript shop, three bugs described by behaviour only (no code names), all 6 sessions correct: plain 439,899 vs NREKI 439,997 tokens (+0.02 %); per pair −3.1 %, −20.3 %, +32.6 %. The pre-registered "saves" criterion was not met. The session logs show the turns NREKI itself cost, fixed below:
|
|
327
|
+
- Two of three NREKI sessions sent `batch_edit` with symbol `RecoveryCodes.redeem`, got "not found", and resent the whole batch: one turn (~20k tokens) each. `references "RecoveryCodes.pending"` answered "No references found" although the method is called.
|
|
328
|
+
- `context` received the whole three-bug task and searched it once: its 4 hits covered two bugs (English query) or none (Spanish query, constants only). The agents then spent two turns reading.
|
|
329
|
+
- They read whole the 20–40-line files of the hits and the helpers those import (`money.ts`, `clock.ts`).
|
|
330
|
+
- **`Class.method` is a symbol name everywhere** (also `::`, `#`, `->`, nested containers, Go receivers). `edit`, `batch_edit`, `compress`/`read` `focus` and `definition` resolve the member inside that container, never a same-named member elsewhere; a bare name defined in two classes is still refused, and the message says to qualify it. `references` matches the member name and says so. The blind-edit rule treats `redeem` and `RecoveryCodes.redeem` as the same symbol. Tests in `tests/qualified-names.test.ts`.
|
|
331
|
+
- **`context` for a task that names no code.**
|
|
332
|
+
- A task that lists several issues is searched issue by issue (list items, else lines, else `;`, else sentences; instruction-only parts dropped), the top 3 hits of each.
|
|
333
|
+
- After each issue's hits, the file where they meet: a small file importing two or more of them. "VAT on shipping" found the rate table and the zone list; the bug was in the invoice builder that imports both.
|
|
334
|
+
- A small file search led to (≤ 80 lines, ≤ 900 tokens) is shown whole and says so: "no further read of it is needed".
|
|
335
|
+
- Under the code, the definitions of 6 lines or fewer it imports (never one that looks like a credential, never from a file already shown).
|
|
336
|
+
- The default budget is 2,000 tokens per issue, up to 3 issues.
|
|
337
|
+
- On the A/B agents' own queries (replayed, no model): the English three-bug query now returns all 3 bug sites in one call (2.3–2.4k tokens, BM25 or Voyage), where it returned 2 of 3 as chunks. The Spanish query returns 2 of 3, where it returned none; Spanish task text against English code remains weak. These were measured on the A/B fixture they were designed from: a fair re-run needs a new project. Tests (a different project) in `tests/token-economy.test.ts`.
|
|
338
|
+
- **Holdout on a new project: +4.97 %.** Same protocol, 3 pairs, a 31-file logistics project written by another agent: plain 447,890 vs NREKI 470,151 tokens, 22 vs 23 turns, all 6 correct, 0 rejected edits, 0 re-reads. Per turn, from the session logs:
|
|
339
|
+
- `context` replaced the plain arm's two reading turns (list the files, then `rg -n .`), and added fewer tokens (2.0–2.6k vs 3.7–4.0k).
|
|
340
|
+
- The plain arm ran `apply_patch` and the checker in one code-mode cell. Every NREKI session sent `batch_edit` alone and ran the checker on the next turn: one more turn (~20k tokens) each.
|
|
341
|
+
- Both arms spent 7 turns finding and running tsc: the task said "until TypeScript compiles" and tsc was not on PATH. NREKI's footer said "run tsc if the exported API changed" after edits that changed no exported type.
|
|
342
|
+
- Cost weighted the way the Codex quota appears to count cached input (≈ 0.15 of a new token, fitted on two windows), with random cache misses removed from both arms: holdout −0.2 %, earlier A/B −3.6 %. Both are ties.
|
|
343
|
+
- **`context` ends with the next step:** one `batch_edit`, and in code mode the tests/checker in the same cell, right after it (33 tokens). Code mode does not send tool descriptions, so the result is where this can be said. Also in templates/AGENTS.md; CLAUDE.md is for a client without code mode.
|
|
344
|
+
- **The file-mode footer says when re-running tsc is redundant.** File mode (a tsconfig project of ≤ 200 files) type-checks the edited files and their direct importers. The kernel now compares, before and after the edit, the `.d.ts` TypeScript emits for the edited files (in memory, also under `noEmit`) and the program's file list.
|
|
345
|
+
- Equal: no other file can type-check differently. The footer says "exported API unchanged, no other file affected … Re-running tsc is redundant".
|
|
346
|
+
- Different: "Exported API changed: transitive importers (e.g. via re-exports) NOT checked — run tsc before finishing".
|
|
347
|
+
- A text diff of the signature misses an inferred return type that changes (`return String(n * 2)`) and a local type behind an export; the `.d.ts` does not.
|
|
348
|
+
- Not compared on the auto-heal path or in hologram mode (the wording there is unchanged).
|
|
349
|
+
- **Fixed: an edit to global declarations was reported as fully checked.** A `global.d.ts`, a script file or a `declare global` block has no importers, so the footer said "no importers … Re-running tsc is redundant", while the files using those globals were never checked. It now says "It changes global declarations: files using them were NOT checked — run tsc before finishing", in file and hologram mode and after auto-heal, unless the emitted declarations are unchanged. Tests in `tests/validation-footer-api.test.ts`.
|
|
350
|
+
- **Second holdout, after these changes: −33.05 %.** Same protocol and AGENTS as the first holdout.
|
|
351
|
+
- Setup: another new project (customer service, three bugs described by behaviour). Git and tsc were ready for both arms, and the checker said it compiles the whole project.
|
|
352
|
+
- Tokens: plain 336,643 vs NREKI + Voyage 225,391.
|
|
353
|
+
- Turns: 18 vs 12. NREKI was ahead in all 3 pairs (−34.0 %, −43.2 %, −17.5 %), and all 6 solutions were correct.
|
|
354
|
+
- Every NREKI session took 4 turns:
|
|
355
|
+
1. checker;
|
|
356
|
+
2. `context`, with all three issues in one call;
|
|
357
|
+
3. `batch_edit`, then the checker in the same cell;
|
|
358
|
+
4. answer.
|
|
359
|
+
- The plain arm spent 2–3 turns reading, and in one pair ran the checker apart from the patch.
|
|
360
|
+
- Neither arm ran tsc on its own, because the checker said it compiles. The footer's "redundant" was therefore not isolated.
|
|
361
|
+
- With cached input weighted ≈ 0.15 and random cache misses removed from both arms: −22 %.
|
|
362
|
+
- The agents translated their `context` queries to English: retrieval with Spanish queries is still untested.
|
|
363
|
+
|
|
364
|
+
## [12.0.0] - 2026-05-24
|
|
365
|
+
|
|
366
|
+
> Pre-release: published to npm under dist-tag `next` as `12.0.0-rc.1`. `latest` remains on v11.x until promotion.
|
|
367
|
+
|
|
368
|
+
**BREAKING CHANGE: `hybrid_search` action amputated.** NREKI is repositioned as an edit-safety MCP. Host agents (Claude Code, Cursor, Continue.dev, Windsurf, Aider, Copilot Chat) bring their own retrieval; NREKI exposes `search` (Type Ledger semantic) and `fast_grep` (RAM-resident exact substring) as local-contingency lexical paths only. The +10pp Recall@5 gain from BM25 RRF fusion did not justify the 4.3× tokens-per-correct-hit overhead (Sprint 6.8 measurement), and Sprint 7.0-pre Furia counter-audit confirmed no real MCP-consuming agent exists that would access `hybrid_search` while lacking BOTH native grep AND `fast_grep` — the two NREKI actions ship in the same tool, so there is no stranded-agent justification.
|
|
369
|
+
|
|
370
|
+
### Removed
|
|
371
|
+
|
|
372
|
+
- **`nreki_navigate action:"hybrid_search"`** — the BM25 + RRF fusion action is gone from the MCP schema, the router switch, and the navigate handler.
|
|
373
|
+
- **`src/bm25-engine.ts`** (BM25Engine class with code-aware tokenizer + per-project index).
|
|
374
|
+
- **`src/hybrid-engine.ts`** (RRF fusion + foveal-on-BM25 layer).
|
|
375
|
+
- **`NrekiEngine.getHybridEngine()`** and **`NrekiEngine.invalidateHybridIndex()`** — public surface removed; any consumer importing these will fail to compile (intentional v12.0.0 break).
|
|
376
|
+
- **`scripts/benchmark-hybrid-smoke.ts`** — the dogfood smoke bench for the hybrid runtime.
|
|
377
|
+
- **28 tests**: `tests/bm25-engine.test.ts` (16) + `tests/hybrid-engine.test.ts` (12).
|
|
378
|
+
- **`.nreki-bench-hybrid.db`** — leftover index from prior hybrid smoke runs.
|
|
379
|
+
|
|
380
|
+
### Why now
|
|
381
|
+
|
|
382
|
+
Sprint 6.6 / 6.7 / 6.8 measurement trajectory:
|
|
383
|
+
|
|
384
|
+
- 6.6: NREKI hybrid loses ~28pp Recall@5 (micro) / ~51pp (macro) vs voyage-code-3 dense embedding. NREKI's retrieval moat against dense embedders is empirically absent.
|
|
385
|
+
- 6.7: The type-aware retrieval niche, as operationalized, contains 1% of PolyBench TS tasks. Hypothesis untestable on this corpus.
|
|
386
|
+
- 6.8: Hybrid's TPCH (per correct hit) is 4.3× **worse** than NREKI standalone, despite +10pp R@5. The recall improvement does not pay for the doubled per-query payload cost.
|
|
387
|
+
|
|
388
|
+
Combined with the Sprint 7.0-pre Furia audit (no agent exists that has `hybrid_search` access AND lacks `fast_grep` access — they ship in the same MCP tool), the action is pure overhead. v12.0.0 amputates it cleanly, following the same precedent as the v11.0.0 ONNX-embeddings amputation.
|
|
389
|
+
|
|
390
|
+
### Migration
|
|
391
|
+
|
|
392
|
+
If you were calling `nreki_navigate action:"hybrid_search"`:
|
|
393
|
+
- **Replace with `action:"search"`** for semantic-first queries. Recall is ~10pp lower at K=5, but token cost drops by ~50% and latency stays under 2s.
|
|
394
|
+
- **Or replace with `action:"fast_grep"`** for exact-substring queries. RAM-resident, sub-ms latency.
|
|
395
|
+
- **Or use your host agent's native grep/ripgrep** when the query is lexically literal and the index isn't warm yet.
|
|
396
|
+
|
|
397
|
+
The MCP schema rejects `action:"hybrid_search"` with "Unknown action" listing the valid set. The unknown-action error message is the canonical signal that you are on v12.0.0+.
|
|
398
|
+
|
|
399
|
+
### Positioning
|
|
400
|
+
|
|
401
|
+
NREKI is now positioned as an **edit-safety MCP**:
|
|
402
|
+
- `nreki_code` (batch_edit ACID + ast-sandbox + TTRD + foveal compression)
|
|
403
|
+
- `nreki_guard` (plans, engrams, memorize, audit, circuit-breaker)
|
|
404
|
+
- `nreki_navigate` (search, fast_grep, definition, references, outline, map, prepare_refactor, orphan_oracle, type_shape, type_graph)
|
|
405
|
+
|
|
406
|
+
The retrieval surface is intentionally narrow: NREKI does not compete with Claude Context / voyage-code-3 / Cursor's semantic search. It complements them by providing safe edits + local lexical contingency.
|
|
407
|
+
|
|
408
|
+
### Added (eval-only, dormant in production)
|
|
409
|
+
|
|
410
|
+
- **`FOVEAL_OFF=1` control-arm gate** in `src/compressor-foveal.ts`, `src/handlers/code/read.ts`, and `src/handlers/navigate.ts` (`handleSearch` + `handleOutline`). When the env var is set to `"1"`, foveal compression is bypassed (raw passthrough) so the Sprint 8.0 measurement harness can compare foveal_on vs foveal_off. **When `FOVEAL_OFF` is unset or any value other than `"1"`, every gated path is byte-identical to pre-v12 behaviour** — the production foveal arm is frozen (Sprint 8.0 pre-registration). Verified by `tests/sprint80-foveal-epicenter.test.ts` (tests D + E). The gate is NOT wired into `edit.ts` because `edit.ts` never invokes `tfcCompress` (see `scripts/eval-phase8/prereg-erratum-01.md`).
|
|
411
|
+
- **Internal measurement suite** under `scripts/eval-phase6..8/` + `docs/sprint-6.6..8.0*.md` (retrieval comparison, type-aware niche test, token economics, foveal net-savings). Not shipped in the npm tarball.
|
|
412
|
+
|
|
413
|
+
## [11.4.2] - 2026-05-19
|
|
414
|
+
|
|
415
|
+
User feedback against v11.4.1 surfaced two genuine bugs and two UX gaps that the v11.4.0 sprint missed. v11.4.2 closes them and centralizes the path-validation helper so future readSource callsites can't regress.
|
|
416
|
+
|
|
417
|
+
### Fixed
|
|
418
|
+
|
|
419
|
+
- **EISDIR crash on `nreki_guard action:"set_plan"` with a directory path.** Reproduced empirically against the installed v11.4.1 binary. [`src/handlers/guard.ts:359`](src/handlers/guard.ts#L359) called `readSource` after only `fs.existsSync`, with no `isDirectory` check; the resulting EISDIR escaped as an opaque MCP error. v11.4.2 routes through the new `validatePath` helper and returns a structured error pointing to "pass the path to your plan file, e.g. `set_plan text:\"PLAN.md\"`".
|
|
420
|
+
- **EISDIR crash on `nreki_guard action:"engram"` with a directory path.** Same root cause at [`src/handlers/guard.ts:465`](src/handlers/guard.ts#L465). Same fix.
|
|
421
|
+
- **`nreki_navigate action:"outline"` silent-failed on a directory path** with the misleading message "may be empty, unsupported, or contain no declarations". The directory crash was being absorbed by `getFileSymbols`'s internal try/catch. v11.4.2 validates the path at the outline handler entry and returns "outline operates on a single file. For directory-wide discovery, use nreki_navigate action:\"search\" / \"fast_grep\" / \"hybrid_search\"".
|
|
422
|
+
- **`nreki_navigate action:"search"` "No results found" message gave no fallback hint.** Symmetric with the existing "Index pending" branch which already mentioned `fast_grep` and `hybrid_search`. v11.4.2 mirrors that wording: the empty-results response now lists `fast_grep`, `hybrid_search` (with the user's query pre-filled for copy-paste), "broaden the query", and `Bash grep` as last resort.
|
|
423
|
+
|
|
424
|
+
### Added
|
|
425
|
+
|
|
426
|
+
- [`src/utils/path-guard.ts`](src/utils/path-guard.ts) — `validatePath()` returns a structured `{ok, kind, error, hint}` result. Catches: ENOENT, EISDIR, FIFO/socket (would block readFileSync indefinitely on POSIX), block/character devices, symlink loops, and the catch-all "not a regular file". Hint text varies by `toolName` ("read", "compress", "outline", "set_plan", "engram", "prepare_refactor") so each handler tells the user the right alternative tool.
|
|
427
|
+
- [`tests/path-guard.test.ts`](tests/path-guard.test.ts) — 6 unit tests covering the public contract (+ 1 POSIX-only FIFO test, skipped on Windows).
|
|
428
|
+
- [`tests/handlers-eisdir-coverage.test.ts`](tests/handlers-eisdir-coverage.test.ts) — 5 router-level regression tests: set_plan/dir, set_plan/missing, engram/dir, outline/dir, plus a regression guard confirming read/compress/dir still works (no rollback of v11.4.0 fix).
|
|
429
|
+
- [`tests/search-no-results-hint.test.ts`](tests/search-no-results-hint.test.ts) — 2 tests pinning the new "No semantic results" fallback wording and confirming the "Index pending" branch is not regressed.
|
|
430
|
+
- [`docs/user-feedback-v11.4.1-investigation.md`](docs/user-feedback-v11.4.1-investigation.md) — empirical investigation report. Each user claim probed against the installed binary, with classification (already fixed / genuine bug / UX gap / as-designed).
|
|
431
|
+
|
|
432
|
+
### Internal — honest process disclosure
|
|
433
|
+
|
|
434
|
+
- v11.4.0's EISDIR fix covered only `handleRead` and `handleCompress`. v11.4.2 audited every `readSource` callsite in `src/handlers/` and `src/router.ts`; the unguarded set was 4 callsites in 2 files. The audit step belonged in v11.4.0 and was skipped — disclosed in `docs/user-feedback-v11.4.1-investigation.md` §3.
|
|
435
|
+
- Subagent investigation surfaced three kernel "bypass" hypotheses for the differential pre-existing-error filter. Two (`purgeCache` wipes baseline; healing cascade not re-filtered) were rejected after reading the source. One (hologram scope mismatch) is plausible but unreproduced; logged for a future round if user reports recur.
|
|
436
|
+
|
|
437
|
+
### Templates
|
|
438
|
+
|
|
439
|
+
- `templates/CLAUDE.md`, `AGENTS.md`, `SKILL.md` updated with a one-line note that "No semantic results" responses now include a fallback list, plus a reminder that set_plan/engram/outline reject directory paths with a tool-specific hint.
|
|
440
|
+
|
|
441
|
+
## [11.4.1] - 2026-05-19
|
|
442
|
+
|
|
443
|
+
### Added
|
|
444
|
+
|
|
445
|
+
- **Hologram-mode regression tests** (Phase 1.5 follow-up to v11.4.0). Four new tests in [`tests/kernel-pre-existing-errors-hologram.test.ts`](tests/kernel-pre-existing-errors-hologram.test.ts) that literally reproduce **TS1259** (`esModuleInterop:true` + `allowSyntheticDefaultImports:false` + `export =` source) and **TS2802** (`target:ES5` + `downlevelIteration:false` + `Set` iteration) — the exact codes the user originally reported — in hologram mode, the production MCP runtime path. The v11.4.0 suite had pinned only project mode and only triggered TS1192 (not TS1259) despite the CHANGELOG claim of "exact scenario" coverage.
|
|
446
|
+
- [`docs/hologram-mode-verify.md`](docs/hologram-mode-verify.md) — empirical PASS report from the hologram-mode round: differential filter works in hologram, including the JIT-specific subcase where the target file enters `rootNames` only at edit time.
|
|
447
|
+
- [`docs/v11.4.0-self-exploration.md`](docs/v11.4.0-self-exploration.md) — 10-finding pre-Furia self-audit that drove the Phase 1.5 round (process documentation; honest list of what I was uncomfortable with after v11.4.0).
|
|
448
|
+
|
|
449
|
+
### Verified empirically (no code fix required)
|
|
450
|
+
|
|
451
|
+
- The differential pre-existing-error check (`count > baseline.get(fingerprint)` at [`src/kernel/backends/ts-compiler-wrapper.ts:611`](src/kernel/backends/ts-compiler-wrapper.ts#L611)) holds in hologram mode for the user's exact TS1259 and TS2802 cases. The user's original report most likely ran against the globally installed `@ruso-0/nreki@10.19.0` (the binary that was active when the report was filed); the fix had already shipped in an earlier release.
|
|
452
|
+
|
|
453
|
+
### Internal
|
|
454
|
+
|
|
455
|
+
- v11.4.0's CHANGELOG entry overstated test coverage. v11.4.1 is the honest closure: same release intent, but with the hologram suite that actually pins the user-reported codes, and a self-exploration document that names what the original sprint missed.
|
|
456
|
+
- All v11.4.0 deliverables remain shipped on the `v11.4.0` tag at commit `984c781`. v11.4.1 strictly adds tests + docs on top; no runtime behavior change.
|
|
457
|
+
|
|
458
|
+
### Tests
|
|
459
|
+
|
|
460
|
+
- 1 427 passed, 3 skipped, 0 failed (+4 vs v11.4.0).
|
|
461
|
+
|
|
462
|
+
## [11.4.0] - 2026-05-19
|
|
463
|
+
|
|
464
|
+
### Fixed
|
|
465
|
+
|
|
466
|
+
- **EISDIR crash on `nreki_code action:"read"` / `action:"compress"` with a directory path.** Both handlers previously called `fs.readFileSync` without a stat guard; passing a directory surfaced an opaque `EISDIR: illegal operation on a directory` error from the MCP server. v11.4.0 explicitly checks `stat.isDirectory()` and returns a structured error that points to the correct tool: `nreki_navigate action:"outline"` for per-file overview, `action:"fast_grep" / "search"` for cross-tree lookup. `ENOENT` (missing file) is now also caught with a structured "Path not found" message instead of an uncaught stack trace.
|
|
467
|
+
- **Regression guards for pre-existing TS errors in edited files.** A user reported (2026-05-19) that NREKI rolled back unrelated edits in `fillTemplate.ts` because of pre-existing TS1259/TS2802 errors elsewhere in the same file. The differential check (`count > baseline.get(fingerprint)` in `src/kernel/backends/ts-compiler-wrapper.ts:611`) was already in place and works correctly in v11.3.x — the user's binary was likely an older release (the globally installed `@ruso-0/nreki@10.19.0`). v11.4.0 closes the test-coverage gap with two suites: one in project mode covering same-file pre-existing TS2322 / TS1192-family, and one in hologram mode (the MCP server's default) covering the user's *exact* TS1259 and TS2802 codes plus a JIT-specific subcase where the target file enters `rootNames` only at edit time.
|
|
468
|
+
|
|
469
|
+
### Added
|
|
470
|
+
|
|
471
|
+
- **`tests/read-compress-directory.test.ts`** — 4 tests covering directory + missing-file inputs to both `handleRead` and `handleCompress`. Confirms EISDIR is gone, error messages name the correct alternative tool, and the response shape is `isError: true` (not a crash).
|
|
472
|
+
- **`tests/kernel-pre-existing-errors.test.ts`** — 4 project-mode tests pinning the same-file pre-existing-error scenario (TS2322, TS1192-family, same-symbol edit, counter-test of genuine new error).
|
|
473
|
+
- **`tests/kernel-pre-existing-errors-hologram.test.ts`** — 4 hologram-mode tests covering the **exact** TS codes the user reported (TS1259 reproduced via `esModuleInterop:true` + `allowSyntheticDefaultImports:false` + `export =` source; TS2802 reproduced via `target:ES5` + `downlevelIteration:false` + Set iteration). Includes a JIT-specific case where the target file is not yet in `rootNames` at boot and only enters via the per-transaction `captureBaseline` ordering.
|
|
474
|
+
- **`docs/furia-v11.4.0-review.md`** — adversarial Q1-Q5 review documenting why the Phase 1 contribution is regression guards (not a code fix), why the EISDIR fix returns an explicit error instead of auto-redirecting, perf claims, anti-silent-failure audit, and two residual gaps (FIFO/device-file handling, un-guarded `readSource` helper).
|
|
475
|
+
- **`docs/v11.4.0-self-exploration.md`** — honest pre-Furia self-audit listing 10 findings I was uncomfortable with after the initial implementation. Drove the additional hologram-mode verification.
|
|
476
|
+
- **`docs/hologram-mode-verify.md`** — empirical verification result for the hologram-mode question raised by Finding D of the self-audit. All 4 hologram tests pass; no kernel scoping bug; no code change required.
|
|
477
|
+
|
|
478
|
+
### Templates
|
|
479
|
+
|
|
480
|
+
- `templates/CLAUDE.md`, `templates/AGENTS.md`, `templates/SKILL.md` updated with:
|
|
481
|
+
- A new "Pre-existing TS errors are NOT blockers (differential check)" note in section 5.
|
|
482
|
+
- A new section 6 ("Input validation") explaining that `read` / `compress` are file operations and directory inputs should use `nreki_navigate`.
|
|
483
|
+
|
|
484
|
+
### Migration
|
|
485
|
+
|
|
486
|
+
- No API change, no file-format change, no breaking signature. Users on v11.3.1 see the EISDIR fix automatically. Behavior on valid file paths is unchanged.
|
|
487
|
+
|
|
488
|
+
## [11.3.1] - 2026-05-19
|
|
489
|
+
|
|
490
|
+
### Changed
|
|
491
|
+
|
|
492
|
+
- **`SYMBOL_REPLACE_LIMIT` default raised 40 L → 100 L.** The legacy 40 L guillotine on `mode:"replace"` was introduced in v9.1 (`3661c31`, 2026-04-13) as a magic number without empirical justification. Phase 1 measurement of 2 880 functions across 5 production TypeScript codebases (NREKI src/, zod, ajv, eventsource, ajv-formats) showed the 40 L cap blocked **10.45% of real-world functions** and **19.06% of NREKI's own source** — a self-inconsistency. The new default (100 L) blocks only 3.02% aggregate (true outliers) and matches NREKI's pre-existing outline auto-expand cutoff (`<=100L` in v10.1.1). The other 10 defense-in-depth gates (anti-sweep shield, kernel TS validation, TTRD, blast radius, Fiedler bridge, Chronos friction, auto-backup, ACID, file lock, topology invalidate) remain unchanged and continue to detect every defect class the size-only gate was incidentally catching.
|
|
493
|
+
- Error message now reports the active threshold and points to the env override:
|
|
494
|
+
`Blocked: Symbol "X" is 55L (>100L). Use mode:"patch" with search_text and replace_text, or override via NREKI_SYMBOL_LIMIT env.`
|
|
495
|
+
|
|
496
|
+
### Added
|
|
497
|
+
|
|
498
|
+
- **`NREKI_SYMBOL_LIMIT` env override** — accepts any integer 1..1000. Parse failures fall back to the default and warn on stderr (never silently disable the gate). Backward-compat: users who prefer the legacy 40 L behavior can set `NREKI_SYMBOL_LIMIT=40`.
|
|
499
|
+
- **`src/limits.ts`** — central, named export `SYMBOL_REPLACE_LIMIT` replaces the magic number `40` in two locations (`src/semantic-edit.ts:637` batch path, `src/semantic-edit.ts:1029` single-edit path).
|
|
500
|
+
- **Empirical analysis docs**:
|
|
501
|
+
- `docs/threshold-empirical-analysis.md` — methodology, samples, percentile distribution, false-positive rates per threshold (40 / 50 / 60 / 70 / 80 / 100 / 120 / 150).
|
|
502
|
+
- `docs/furia-threshold-review.md` — adversarial Q1–Q5 review (arbitrariness check, risk surface analysis, ratio-vs-absolute, env-override constraints, legitimate-rewrite scenario).
|
|
503
|
+
- `scripts/analyze-symbol-sizes.mjs` — reproducible analysis script (TypeScript Compiler API), regenerable on demand.
|
|
504
|
+
- **Tests** — `tests/semantic-edit.test.ts` adds three cases: (a) 55 L symbol is now allowed, (b) 120 L god-function still blocked, (c) error message dynamically reflects active threshold.
|
|
505
|
+
|
|
506
|
+
### Templates
|
|
507
|
+
|
|
508
|
+
- `templates/CLAUDE.md`, `templates/AGENTS.md`, `templates/SKILL.md` updated to document the new 100 L default and the `NREKI_SYMBOL_LIMIT` override.
|
|
509
|
+
|
|
510
|
+
### Migration
|
|
511
|
+
|
|
512
|
+
- **Existing users:** the only externally-visible change is that symbols 41–100 L now accept `mode:"replace"` where they were previously rejected. No file format change, no API change, no breaking signature. To restore exact pre-v11.3.1 behavior, set `NREKI_SYMBOL_LIMIT=40` in your environment.
|
|
513
|
+
|
|
514
|
+
## [11.3.0] - 2026-05-19
|
|
515
|
+
|
|
516
|
+
### Added
|
|
517
|
+
|
|
518
|
+
- **Agent-aware `nreki init` CLI** — pre-v11.3.0 `nreki init` unconditionally wrote `CLAUDE.md`, `AGENTS.md`, `SKILL.md` plus a Claude Code-specific PreToolUse hook into every project regardless of which AI coding agent the user actually ran. v11.3.0 detects the agent from filesystem signals (`.claude/` / `CLAUDE.md` → claude, `.cursor/` / `.cursorrules` → cursor, `.clinerules` → cline, `.github/copilot-instructions.md` → copilot) and installs only the files that agent reads:
|
|
519
|
+
- **claude**: `CLAUDE.md`, `SKILL.md`, `.claude/hooks/nreki-enforcer.mjs`, `.claude/settings.json` PreToolUse merge.
|
|
520
|
+
- **cursor**: `.cursor/rules/nreki.mdc` with `alwaysApply: true` frontmatter.
|
|
521
|
+
- **cline**: `.clinerules/nreki.md`.
|
|
522
|
+
- **copilot**: `.github/copilot-instructions.md` (appended if pre-existing).
|
|
523
|
+
- **generic** (no signal): `AGENTS.md` + an honest disclosure pointing at the `--agent` flag.
|
|
524
|
+
Flags: `--agent <claude|cursor|cline|copilot|generic>` overrides detection; `--force` rewrites an existing NREKI block; `--dry-run` previews the plan without filesystem writes. The pre-existing NREKI marker check is preserved per file, so `nreki init` remains idempotent.
|
|
525
|
+
- **`tests/cli-init.test.ts`** — 28 filesystem-based tests covering detection priority, all agent install paths, idempotency (marker-based skip), `--force` rewrite, `--dry-run` no-op semantics, and end-to-end auto-detection.
|
|
526
|
+
|
|
527
|
+
### Changed
|
|
528
|
+
|
|
529
|
+
- The Claude Code enforcer hook moved from a TypeScript template literal in `src/index.ts` (`getEnforcerScriptContent()`) to a real file at `templates/hooks/nreki-enforcer.mjs`. Template content is read at runtime via `fs.readFileSync`, so future edits to the hook source no longer require navigating nested backslash-escape gymnastics. The runtime behavior of the hook is unchanged.
|
|
530
|
+
- `nreki --help` now documents the `init` subcommand flags.
|
|
531
|
+
|
|
532
|
+
### Internal
|
|
533
|
+
|
|
534
|
+
- `src/init/agent-detect.ts` — pure detector returning `{ agent, reason, detected }`.
|
|
535
|
+
- `src/init/init-runner.ts` — orchestrator with `parseInitArgs`, `runInit`, and `formatAction`. Pure functions over the filesystem so tests can `mkdtemp` and assert against on-disk outcomes. The Claude-Code-only `.claude/settings.json` merge is conservative: it preserves user-added PreToolUse matchers and only inserts the ones NREKI owns; malformed JSON aborts the merge with a clear message instead of clobbering the file.
|
|
536
|
+
|
|
537
|
+
### Migration notes
|
|
538
|
+
|
|
539
|
+
- Existing Claude Code installs are unaffected: the detector sees their `.claude/` directory and continues to install the same Claude-Code files. Re-running `nreki init` on a v11.2.x Claude Code project will report all four target files as `[skip]` (markers already present).
|
|
540
|
+
- Cursor / Cline / Copilot users on v11.2.x who ran `nreki init` and ended up with stray `CLAUDE.md` / `SKILL.md` files can safely delete them — v11.3.0 will now write the correct agent-specific files for them on the next run.
|
|
541
|
+
|
|
542
|
+
## [11.2.1] - 2026-05-19
|
|
543
|
+
|
|
544
|
+
Hot-fix release. v11.2.0 surfaced an EOF-style MCP crash on real-world
|
|
545
|
+
repositories when Claude Code invoked `nreki_navigate action="hybrid_search"`
|
|
546
|
+
(and to a lesser extent `search`, `map`, `orphan_oracle`, `fast_grep`).
|
|
547
|
+
Empirical reproduction via stdio probe in this repo (D:/Nreki, ~12k source
|
|
548
|
+
files, heavy dot-trees `.eval-phase5-cache/` and `.venv-aider/`) showed the
|
|
549
|
+
server never responded inside the client's tool-call timeout window — Claude
|
|
550
|
+
Code surfaced this as `connection closed: calling tools/call: client is closing: EOF`.
|
|
551
|
+
|
|
552
|
+
### Fixed
|
|
553
|
+
|
|
554
|
+
- **MCP EOF on first `hybrid_search` / `search` on real repos** — three
|
|
555
|
+
independent directory walks (NREKI indexer `walkDirectory`, the Phase 5
|
|
556
|
+
repo-map `walkFiles`, and chokidar's initial scan) used synchronous
|
|
557
|
+
`fs.readdirSync` and did NOT skip dot-prefixed directories. Heavy
|
|
558
|
+
dot-trees (`.venv*`, `.cache`, `.turbo`, `.parcel-cache`, `.pytest_cache`,
|
|
559
|
+
`.mypy_cache`, `.ruff_cache`, `.eval-phase5-cache`, `.nreki-runtime`,
|
|
560
|
+
etc.) blocked the MCP event loop for tens of seconds to minutes. All
|
|
561
|
+
three walkers now mirror `BM25Engine.walkSourceFiles`'s policy and skip
|
|
562
|
+
any dot-prefixed directory.
|
|
563
|
+
- **Watcher initialization no longer blocks server startup** — pre-v11.2.1
|
|
564
|
+
`await engine.startWatcher()` ran inside `main()` AFTER `server.connect(transport)`,
|
|
565
|
+
so the MCP transport accepted requests but the watcher's chokidar scan
|
|
566
|
+
prevented handlers from making forward progress. The watcher now starts
|
|
567
|
+
in the background; readiness is logged when chokidar emits `ready`.
|
|
568
|
+
- **First-call full-project indexing no longer awaited inside tool
|
|
569
|
+
handlers** — `hybrid_search`, `search`, `map`, and `orphan_oracle` now
|
|
570
|
+
kick off `engine.indexDirectory()` in the background via
|
|
571
|
+
`engine.ensureIndexedBackground()` and return immediately with whatever
|
|
572
|
+
the current index supports. `hybrid_search` surfaces useful BM25 results
|
|
573
|
+
on the first call even while NREKI's semantic index warms up; `search`
|
|
574
|
+
returns a "warming" hint guiding the user to `hybrid_search` / `fast_grep`
|
|
575
|
+
for an immediate answer. `fast_grep` keeps its existing synchronous
|
|
576
|
+
bootstrap because the RAM cache contract depends on it.
|
|
577
|
+
- **Defensive `unhandledRejection` / `uncaughtException` handlers** —
|
|
578
|
+
unexpected async errors no longer terminate the MCP process. Both are
|
|
579
|
+
logged to stderr (never stdout, which would corrupt JSON-RPC) and the
|
|
580
|
+
server keeps serving.
|
|
581
|
+
|
|
582
|
+
### Internal
|
|
583
|
+
|
|
584
|
+
- `NrekiEngine.ensureIndexedBackground()` coalesces concurrent
|
|
585
|
+
first-call indexing requests onto a single in-flight promise.
|
|
586
|
+
- chokidar v4 `ignored` option migrated from an array of glob strings
|
|
587
|
+
(a v3 form not natively interpreted by v4) to a predicate function
|
|
588
|
+
that combines dot-prefix skipping with the configured glob list via
|
|
589
|
+
`picomatch.isMatch`.
|
|
590
|
+
|
|
591
|
+
## [11.2.0] - 2026-05-18
|
|
592
|
+
|
|
593
|
+
### Added
|
|
594
|
+
- **Hybrid Runtime Integration (Phase 5.5.2)**: New `nreki_navigate
|
|
595
|
+
action="hybrid_search"` exposes the Type Ledger semantic + BM25
|
|
596
|
+
lexical fusion (RRF) documented in the Phase 5 paper to the
|
|
597
|
+
production MCP runtime. Previously only reachable via eval scripts.
|
|
598
|
+
- **`src/bm25-engine.ts`**: BM25 lexical retrieval migrated from
|
|
599
|
+
`scripts/eval-phase5/runners/bm25-runner.ts` to production runtime.
|
|
600
|
+
Standard Okapi (k1=1.5, b=0.75); code-aware tokenization (PascalCase
|
|
601
|
+
/ snake_case / camelCase decomposition, 2-char minimum). Lazy
|
|
602
|
+
in-memory index built on first `search()`; invalidated on
|
|
603
|
+
`indexFile()` / `indexDirectory()` mutations.
|
|
604
|
+
- **`src/hybrid-engine.ts`**: Hybrid RRF engine. Calls NREKI semantic
|
|
605
|
+
search + BM25 in parallel, fuses file rankings via Reciprocal Rank
|
|
606
|
+
Fusion (k=60), deterministic tie-break by `localeCompare`. Returns
|
|
607
|
+
unified results with `source: "nreki" | "bm25" | "both"` origin
|
|
608
|
+
tracking.
|
|
609
|
+
- **Foveal compression on BM25-only files (Reto 5)**: Files surfaced
|
|
610
|
+
exclusively by BM25 (≥100 lines) receive `tfcCompress` with a focus
|
|
611
|
+
symbol extracted from the query. Aligns with the
|
|
612
|
+
`compressor-foveal.ts:109` small-file bypass threshold to avoid
|
|
613
|
+
no-op compressor calls.
|
|
614
|
+
- **`NrekiEngine.getHybridEngine()` + `invalidateHybridIndex()`**:
|
|
615
|
+
lazy-construction of the hybrid stack; BM25 cache auto-invalidates
|
|
616
|
+
on `indexFile()` and `indexDirectory()`.
|
|
617
|
+
- **`BM25EngineOptions.excludedDirs`**: configurable directory exclusion
|
|
618
|
+
for projects with non-standard build/fixture roots. Default excludes
|
|
619
|
+
`node_modules`, `.git`, `.nreki`, `dist`, `build`, `coverage`,
|
|
620
|
+
`.next`, `__pycache__`, `corpus`, plus any dot-prefixed directory.
|
|
621
|
+
- **`scripts/benchmark-hybrid-smoke.ts`**: reproducible dogfood smoke
|
|
622
|
+
bench (`action="search"` vs `action="hybrid_search"`) on NREKI's own
|
|
623
|
+
`src/`. Run with `npx tsx scripts/benchmark-hybrid-smoke.ts`.
|
|
624
|
+
- **`docs/sprint-6.5-empirical.md`**: honest Sprint 6.5 empirical
|
|
625
|
+
findings + N=99 PolyBench re-bench deferral disclosure.
|
|
626
|
+
- **28 new tests**: `tests/bm25-engine.test.ts` (16) +
|
|
627
|
+
`tests/hybrid-engine.test.ts` (12). Full suite: 1384 pass.
|
|
628
|
+
|
|
629
|
+
### Changed
|
|
630
|
+
- **`nreki_navigate` action enum**: `hybrid_search` added to
|
|
631
|
+
`src/index.ts` MCP schema and `src/router.ts` switch dispatch.
|
|
632
|
+
Existing actions (`search`, `fast_grep`, `definition`, `references`,
|
|
633
|
+
`outline`, `map`, `prepare_refactor`, `orphan_oracle`, `type_shape`,
|
|
634
|
+
`type_graph`) preserved unchanged — backward compatible.
|
|
635
|
+
|
|
636
|
+
### Internal
|
|
637
|
+
- Hybrid retrieval previously available only in eval scripts
|
|
638
|
+
(`scripts/eval-phase5/runners/hybrid-runner.ts`). The eval runner
|
|
639
|
+
remains unchanged for paper reproducibility; production now uses
|
|
640
|
+
the migrated `src/hybrid-engine.ts`.
|
|
641
|
+
- "El mejor que se quede" architectural decision: hybrid USES the
|
|
642
|
+
underlying retrievers, does NOT replace them. Users still pick
|
|
643
|
+
`search` for pure topological queries (lower tokens) and
|
|
644
|
+
`hybrid_search` for accuracy-critical retrieval (≈3-5x tokens, per
|
|
645
|
+
Sprint 6.4 paper; dogfood smoke shows up to ~3x on tiny corpora).
|
|
646
|
+
|
|
647
|
+
### Empirical findings (honest)
|
|
648
|
+
- **Dogfood smoke (73 files, 8 queries)**: `search` recall 60% vs
|
|
649
|
+
`hybrid_search` recall 60% (Δ=0pp). Hybrid pays 207% token overhead
|
|
650
|
+
with no recall gain on this micro-corpus. This is expected — the
|
|
651
|
+
Sprint 6.4 paper's +15pp FHR gain was measured on N=99 diverse
|
|
652
|
+
external repos, not on a single internal codebase.
|
|
653
|
+
- **Sprint 6.5 N=99 PolyBench re-benchmark: DEFERRED**. The directive
|
|
654
|
+
required this empirical step; this commit ships without it. Reason:
|
|
655
|
+
the eval orchestrator (`scripts/eval-phase5/orchestrate.ts`)
|
|
656
|
+
constructs its own runners and would need re-plumbing to invoke the
|
|
657
|
+
migrated `HybridEngine`; the bench itself is multi-hour. Tracked as
|
|
658
|
+
Sprint 6.5.1 in `docs/sprint-6.5-empirical.md`.
|
|
659
|
+
- **Token cost is real, not noise**. BM25 returns file-level payloads;
|
|
660
|
+
even with foveal compression on BM25-only files ≥100 lines, hybrid
|
|
661
|
+
hits cost more than NREKI-only AST chunks.
|
|
662
|
+
|
|
663
|
+
### Wall-clock honesty
|
|
664
|
+
- Original Pipipi estimate: 4 hours. Actual: ~3 hours implementation
|
|
665
|
+
+ path-rooting bug discovery + dot-dir corpus walk bug discovery +
|
|
666
|
+
bench-corpus hang debug. Closer to the directive's "1-2 días"
|
|
667
|
+
honest estimate than the 4-hour Pipipi figure.
|
|
668
|
+
|
|
669
|
+
## [11.1.0] - 2026-05-18
|
|
670
|
+
|
|
671
|
+
### Added
|
|
672
|
+
- **Real BPE tokenizer**: tiktoken cl100k_base integration via
|
|
673
|
+
`src/utils/token-estimator.ts`. Replaces chars/3.5 heuristic for
|
|
674
|
+
token cost estimation. Heuristic preserved as fallback (zero-downtime).
|
|
675
|
+
Empirical verification: 72-file benchmark 276,516 raw → 60,732
|
|
676
|
+
compressed = 78% savings sostained con real BPE tokenizer.
|
|
677
|
+
- **Defense-in-depth conditional compression**: compressor-level
|
|
678
|
+
bypass for files <100 lines OR <1024 bytes (`src/compressor-foveal.ts`
|
|
679
|
+
:102-123). Complements existing handler-level bypass
|
|
680
|
+
(`src/handlers/code/read.ts:84`). Zero overhead instances confirmed
|
|
681
|
+
empirically across all file-size buckets (72 files tested).
|
|
682
|
+
- **`bySize` SessionReport field**: per-file-size tracking buckets
|
|
683
|
+
(<100L, 100-299L, 300-999L, ≥1000L) in `engine.getSessionReport()`
|
|
684
|
+
output. Enables empirical analysis of compression effectiveness by
|
|
685
|
+
file size class.
|
|
686
|
+
- **Empirical benchmark scripts**: `scripts/benchmark-token-economics.ts`
|
|
687
|
+
+ `scripts/simulate-claude-session.ts` for ongoing verification.
|
|
688
|
+
- **Token economics empirical verify documentation**:
|
|
689
|
+
`docs/token-economics-empirical-verify.md` documents Sprint Empirical
|
|
690
|
+
Verify findings honest including methodology caveats.
|
|
691
|
+
|
|
692
|
+
### Changed
|
|
693
|
+
- **Template adelgazamiento**:
|
|
694
|
+
`templates/CLAUDE.md` 3,965 → 1,670 bytes (495 BPE tokens, ~58% reduction)
|
|
695
|
+
`templates/AGENTS.md` 3,885 → 1,253 bytes (372 BPE tokens, ~68% reduction)
|
|
696
|
+
Combined 867 BPE tokens (~61% reduction, ~8% over Apr 2026 target
|
|
697
|
+
of 800 combined tokens, honest disclosure of remaining gap).
|
|
698
|
+
- **Token cost estimation accuracy**: real BPE tokenizer measurement
|
|
699
|
+
replaces direccional-but-imprecise chars/3.5 heuristic. Heuristic
|
|
700
|
+
validated within ~10% magnitude accuracy of real BPE empírico.
|
|
701
|
+
|
|
702
|
+
### Internal
|
|
703
|
+
- Sprint Empirical Token Economics Verify executed pre-Phase 5.5.1:
|
|
704
|
+
- 72-file per-bucket benchmark
|
|
705
|
+
- 45-file session simulation
|
|
706
|
+
- Zero overhead instances confirmed empírico
|
|
707
|
+
- Claim "29 calls vs 5-7 without TFC-Pro" marked UNVERIFIABLE
|
|
708
|
+
(no measurement code exists)
|
|
709
|
+
- Reto 8 Causal Program Slicing Phase 0 design committed
|
|
710
|
+
(`docs/adrs/reto-8-causal-slicing/`, strategic pause Nova Phase 8.2-8.5
|
|
711
|
+
prerequisite for Reto 7 Compiler-Hijacking)
|
|
712
|
+
|
|
713
|
+
### Deferred
|
|
714
|
+
- **Phase 5.5.2**: Hybrid runtime integration (Reto 5).
|
|
715
|
+
Migrate `scripts/eval-phase5/runners/hybrid-runner.ts` →
|
|
716
|
+
`src/hybrid-engine.ts`. Foveal compression on BM25-fused files.
|
|
717
|
+
- **Phase 5.5.3**: Comparative head-to-head benchmarks
|
|
718
|
+
(NREKI vs Corsa, Zilliz Claude Context, codebase-memory-mcp, GitNexus).
|
|
719
|
+
Currently disclosed as research gap.
|
|
720
|
+
|
|
721
|
+
## [11.0.2] - 2026-05-16
|
|
722
|
+
|
|
723
|
+
Mini-sprint closure for v11.0.1 cabos sueltos. No new features; only
|
|
724
|
+
empirical closure of v11.0.1 measurement, query, and paper deliverables.
|
|
725
|
+
|
|
726
|
+
### Added
|
|
727
|
+
|
|
728
|
+
- **Corpus measurement consolidation**: `docs/paper-phase5/corpus-measurements-v11.0.1.json` ships full distribution stats (n_files, aggregate %, p50, p95) for six OSS corpora — Spring Boot Java (748 files, 81.3% aggregate), Square Okio Kotlin (306 files, 80.8%), nowinandroid app/ Kotlin Android (16 files, 89.4%), abseil-cpp absl/strings .cc (103 files, 89.9%), redis src/ C (133 files, 92.4%), abseil-cpp absl/strings .h C++-routed (66 files, 88.7%). Closes the Phase 7 abort from v11.0.1 sprint where Node was not installed in WSL2.
|
|
729
|
+
- **Paper compile reproducibility**: `scripts/compile-paper-pdf.mjs` re-compiles the Phase 5 paper PDF via Chrome headless + Skia/PDF, matching the v11.0.0/v11.0.1 PDF metadata profile. `docs/paper-phase5/paper-style.css` provides academic-paper rendering. `marked` added to devDependencies.
|
|
730
|
+
|
|
731
|
+
### Fixed
|
|
732
|
+
|
|
733
|
+
- **typedef C variants in `C_QUERY`** (v11.0.1 empirical discrepancy): `typedef struct Foo Foo;` previously produced only a `@class` chunk for the inner struct because chunk dedup dropped the outer typedef match with the same symbol name. Added `type_definition` variants for named-struct and named-enum typedef aliases plus function-pointer typedef (`typedef int (*callback_t)(int)`). Dedup now allows a strictly-containing chunk with a different `nodeType` to replace the inner chunk (preserves equal-range dedup unchanged).
|
|
734
|
+
|
|
735
|
+
### Changed
|
|
736
|
+
|
|
737
|
+
- Phase 5 paper Section 6.4 (all three drafts: arxiv, arxiv-restored, submission) updated to v11.0.1 12-binding active grammar set (adds `.c` and `.h` header routing), retained three-capability-gate disclosure, plus corpus measurement table sourced from `corpus-measurements-v11.0.1.json` with explicit bias disclosure (well-maintained OSS reference repos; distribution exposed via p50/p95). PDF re-compiled (HeadlessChrome 148).
|
|
738
|
+
|
|
739
|
+
## [11.0.1] - 2026-05-16
|
|
740
|
+
|
|
741
|
+
### Added
|
|
742
|
+
|
|
743
|
+
- **C language activation**: tree-sitter-c@0.20.7 grammar activated for `.c` files. Captures function definitions (including pointer-returning functions via nested `pointer_declarator` variants), struct/union/enum/typedef declarations, and forward declarations. C99 designated initializers parse without ERROR nodes.
|
|
744
|
+
|
|
745
|
+
- **Header file routing (`.h`)**: dynamic detection of C vs C++ at parse time. Headers containing C++ markers (template, namespace, class, `#ifdef __cplusplus`, `extern "C"`, scope-resolution `::`, access specifiers) route to tree-sitter-cpp grammar; pure C headers route to tree-sitter-c grammar. Default: C grammar (smaller WASM load: 792 KB vs 4.6 MB). Empirically verified against abseil-cpp/absl/strings/ (66 .h files, 870 chunks produced vs 0 pre-fix; 88.7% aggregate compression savings).
|
|
746
|
+
|
|
747
|
+
- **Cross-language compression measurement script**: `scripts/measure-cross-language-savings.mjs` (with README) for empirical corpus benchmarking.
|
|
748
|
+
|
|
749
|
+
- **Corpus measurement data**: production corpora measured — Spring Boot (Java, via WSL2), Square Okio (Kotlin, 39 files, 82.6% savings), Abseil (C++ .cc 103 files 89.9% + .h 66 files 88.7%), Redis (C, pending).
|
|
750
|
+
|
|
751
|
+
### Fixed
|
|
752
|
+
|
|
753
|
+
- **`.c` and `.h` files invisible to parser** (silent activation gap from v11.0.0): LANGUAGE_CONFIGS missing entries caused parser to return 0 chunks with `language: "unsupported"` for C source and header files despite tree-sitter-c WASM being bundled. Confirmed empirically against Abseil headers (66 .h files: 0→870 chunks post-fix).
|
|
754
|
+
|
|
755
|
+
- **extractName regex fallback C keyword safety** (Furia 41 Adicional 1, Furia 42 Adicional 2): semantic-edit fallback regex captured first word of C function declarations ("void", "int", "static") as symbol name when AST extraction failed. Added explicit C/C++ pattern with keyword denylist; keyword matches return empty string.
|
|
756
|
+
|
|
757
|
+
- **C pointer declarator blindness** (Furia 42 Adicional 1): C functions returning pointers (`char *strdup`, `int **alloc`) were invisible to symbol extraction because `function_declarator` nests inside `pointer_declarator`. Added 3 declarator variant captures to C_QUERY.
|
|
758
|
+
|
|
759
|
+
### Changed
|
|
760
|
+
|
|
761
|
+
- README "AST parser coverage" table extended for C row with `.h` header-routing footnote.
|
|
762
|
+
- package.json description updated to include C in parser-level support list.
|
|
763
|
+
- CPP_QUERY used for .h files routed to C++ grammar (was incorrectly using C_QUERY for all .h files).
|
|
764
|
+
|
|
765
|
+
### Known Limitations
|
|
766
|
+
|
|
767
|
+
- **Android XML / Gradle Groovy NOT indexed**: tracked as issue #4. v11.0.2 target.
|
|
768
|
+
- **download-wasm.js SHA-256 checksums**: tracked as issue #5.
|
|
769
|
+
- **chunks table language column**: breaking migration tracked as issue #6.
|
|
770
|
+
|
|
771
|
+
## [11.0.0] - 2026-05-15
|
|
772
|
+
|
|
773
|
+
### BREAKING CHANGES
|
|
774
|
+
|
|
775
|
+
- **Removed**: ONNX embeddings dependency (`@xenova/transformers`). Users relying on embedding-based retrieval should migrate to Hybrid RRF (NREKI Type Ledger + BM25 file-level fusion) or to an external dense embedding provider (`voyage-code-3`, OpenAI, etc.). The removed embedding code was unused by NREKI's primary retrieval path and added substantial package weight and runtime memory risk. Migration path for local evaluation workflows: `hybrid-rrf` runner.
|
|
776
|
+
|
|
777
|
+
### Added
|
|
778
|
+
|
|
779
|
+
- **Hybrid RRF retrieval**: Late-fusion file-level RRF combining NREKI Type Ledger + BM25. See `scripts/eval-phase5/runners/hybrid-runner.ts`.
|
|
780
|
+
- **Multi-language parser activation**: tree-sitter grammars for Kotlin (.kt / .kts), Java (.java), and C++ (.cpp / .cc / .cxx / .hpp / .hh / .hxx) activated via tree-sitter-wasms bundle. Targets Android development (Kotlin app + Java legacy + C++ NDK) and the broader JVM / native cross-platform ecosystem. Files in these languages now receive foveal compression, semantic-edit syntactic validation, and inclusion in the retrieval index.
|
|
781
|
+
- **DEFAULT_EXTENSIONS retroactive fix**: indexer FS watcher now includes .mjs / .cjs / .mts / .cts which were parser-supported since v10.12.0 but never reached the walker. Plus the 9 new Kotlin/Java/C++ extensions.
|
|
782
|
+
- **Type Ledger pollution guard**: extractTypeIO now gated to TypeScript/JavaScript family extensions. Prevents phantom type extractions from Kotlin/Java/C++ regex matches from polluting symbol_io and corrupting TFC-Pro cross-file injection, type-graph queries, and in-degree ranking.
|
|
783
|
+
- **Activation smoke tests**: tests/parser-kotlin.test.ts, tests/parser-java.test.ts, tests/parser-cpp.test.ts, plus tests/parser-multilang-smoke.test.ts as regression guard against tree-sitter-wasms grammar upgrades.
|
|
784
|
+
- **Adversarial methodology**: adversarial AI-in-the-loop auditing protocol documented in the Phase 5 paper draft Section 3.5.
|
|
785
|
+
- **Bonferroni-corrected significance testing**: bootstrap CI95% + Bonferroni `alpha=0.01` for multi-hypothesis evaluation.
|
|
786
|
+
- **Phase 5 paper artifacts**: submission-ready paper draft and anonymous supplementary archive under `docs/paper-phase5/`.
|
|
787
|
+
- **Cross-file mode detection**: `src/detect-mode.ts` module, preserving mode behavior while isolating test imports from CLI side effects.
|
|
788
|
+
- **Materia Oscura rescue disclosure**: 4 tasks where Hybrid RRF reached Rank-1 despite NREKI Top-10 miss; 10 tasks where Hybrid RRF reached Rank-1 despite neither standalone retriever being Rank-1.
|
|
789
|
+
|
|
790
|
+
### Changed
|
|
791
|
+
|
|
792
|
+
- **Sprint 6.4 evaluation**: N=99 PolyBench-Verified TypeScript tribunal verified Hybrid RRF FHR 0.566 vs NREKI 0.414 vs BM25 0.374; 9/10 hybrid deltas survive Bonferroni correction.
|
|
793
|
+
- README "Language support" section renamed to "Language support (Validation + Auto-heal)" to disambiguate LSP-backed capabilities from AST parser coverage.
|
|
794
|
+
- New "AST parser coverage" section documents foveal + retrieval + syntax-check capability for the 10-language active parser set with explicit Type Ledger TS-only disclosure.
|
|
795
|
+
- Phase 5 paper Section 6.4 updated: active parser languages from 7 to 10. Empirical Phase 5 claims unchanged (TypeScript N=99 PolyBench-Verified remains the entire evaluation corpus).
|
|
796
|
+
- **Test lifecycle hooks**: WASM/engine resources now have release-safe teardown paths for Vitest forks, covering `ASTParser`, `AstSandbox`, `ParserPool`, `NrekiDB`, and `NrekiEngine`.
|
|
797
|
+
- **Evaluation orchestration**: `hybrid-rrf` is available via `--runners`; default runner set remains backward-compatible with the seven historical report runners.
|
|
798
|
+
|
|
799
|
+
### Known Limitations
|
|
800
|
+
|
|
801
|
+
- Cross-file dependency graph for Kotlin/Java/C++ files is intra-file only. Import statements not yet parsed for repo-map edges. Cross-file import resolution tracked as v11.0.x.1.
|
|
802
|
+
- Type Ledger (TypeScript compiler-derived architectural deps) remains TypeScript-specific by design. Multi-language Type Ledger tracked as Phase 8 roadmap.
|
|
803
|
+
- LSP auto-heal unchanged: only TS/JS/Go/Python receive codeAction-based auto-heal. Kotlin/Java/C++ surface syntax errors via tree-sitter ERROR / MISSING detection without auto-heal attempts.
|
|
804
|
+
- .h files (ambiguous C vs C++) are excluded from default C++ activation. Users with C++ projects using .h for headers can opt-in via config.extensions override.
|
|
805
|
+
|
|
806
|
+
### Deferred (tracked)
|
|
807
|
+
|
|
808
|
+
- download-wasm.js SHA-256 checksum verification (issue #TBD)
|
|
809
|
+
- Cross-file imports for Kotlin/Java/C++ (issue #TBD)
|
|
810
|
+
- README test count badge update 783 → current (TECH_DEBT)
|
|
811
|
+
- semantic-edit.ts:98 .tsx → "typescript" (bug, out of scope)
|
|
812
|
+
|
|
813
|
+
### Fixed
|
|
814
|
+
|
|
815
|
+
- **WASM Tree-sitter cleanup**: hygienic parser/query teardown prevents cumulative WASM allocations from surviving test-file boundaries.
|
|
816
|
+
- **Cached prepared statements**: cached SQL statement cleanup eliminates sql.js WASM refcount overflow.
|
|
817
|
+
- **Child process task isolation**: per-task evaluation isolation protects long PolyBench runs.
|
|
818
|
+
- **Tree-sitter SDK pin**: MCP SDK `1.23.1` fixes silent tool drops in strict MCP clients.
|
|
819
|
+
- **CSS parser gaps**: at-rules + focus normalization asymmetry.
|
|
820
|
+
- **Cognitive Enforcer deadlock**: Chronos recovery via `_nreki_bypass`.
|
|
821
|
+
- **Backward compatibility test OOM**: `backward-compat.test.ts` now uses a tiny temp workspace instead of scanning the full repository root for definition/reference tests.
|
|
822
|
+
|
|
823
|
+
### Internal
|
|
824
|
+
|
|
825
|
+
- Working tree covers Sprint 4.7 through Sprint 6.4 plus Phase 5 paper artifacts.
|
|
826
|
+
- Trilateral methodology: 40 adversarial rounds completed pre-release.
|
|
827
|
+
- Anti-silent-failure disclosures retained for methodology, statistics, reliability, token cost, and case-study claims.
|
|
828
|
+
|
|
829
|
+
## [10.19.0] - 2026-05-05
|
|
830
|
+
|
|
831
|
+
# v10.19.0 — Zombie shutdown fix (parent watchdog + signal handlers)
|
|
832
|
+
|
|
833
|
+
Sprint focus: prevent NREKI processes from surviving as zombies when their
|
|
834
|
+
parent terminal or MCP host dies — observed in field as 8.5 GB RAM consumption
|
|
835
|
+
with `--enable-embeddings` orphaned after Windows console close. Two-layer
|
|
836
|
+
defense ensures shutdown across signal-delivery edge cases.
|
|
837
|
+
|
|
838
|
+
## Fixed
|
|
839
|
+
|
|
840
|
+
### Zombie processes after parent terminal / MCP host dies (`32b4fc3`)
|
|
841
|
+
Two-layer defense added to `gracefulShutdown`:
|
|
842
|
+
|
|
843
|
+
1. **Signal/event listeners** — extends prior SIGINT/SIGTERM coverage with
|
|
844
|
+
SIGHUP (POSIX hygiene) and `process.stdin` `'close'` / `'end'` events
|
|
845
|
+
(cross-platform pipe-break detection). The handler remains 100% synchronous;
|
|
846
|
+
async paths in shutdown risked event-loop stalls leaving the process zombie
|
|
847
|
+
indefinitely.
|
|
848
|
+
|
|
849
|
+
2. **Parent process watchdog** — `process.kill(ppid, 0)` polled every 3s,
|
|
850
|
+
triggers shutdown on `ESRCH`. Covers Windows X-close of console (where
|
|
851
|
+
SIGHUP and stdin EOF are not delivered), MCP host SIGKILLed, and
|
|
852
|
+
Electron-inherited handles keeping pipes alive after the parent dies.
|
|
853
|
+
Timer is `unref()`'d so MCP graceful close still terminates cleanly.
|
|
854
|
+
|
|
855
|
+
`EPERM` / `EACCES` on the parent check are treated as parent-alive (avoids
|
|
856
|
+
false-positive suicide when antivirus or permissions block `OpenProcess`).
|
|
857
|
+
|
|
858
|
+
Empirically verified on Windows: physical X-click on PowerShell window running
|
|
859
|
+
`nreki --enable-embeddings` kills the process within `PARENT_CHECK_MS` (~3s),
|
|
860
|
+
including the 505 MB orphan observed during sprint testing.
|
|
861
|
+
|
|
862
|
+
## Notes
|
|
863
|
+
|
|
864
|
+
### Test platform skips
|
|
865
|
+
Integration tests (`zombie-shutdown.test.ts`, `zombie-watchdog.test.ts`) are
|
|
866
|
+
skipped on Windows due to non-deterministic process-state semantics during PID
|
|
867
|
+
transitions and ~25s NREKI cold-start time exceeding test budget. Linux/Mac
|
|
868
|
+
CI passes deterministically. Manual verification (PowerShell X-click) is the
|
|
869
|
+
source of truth for Windows.
|
|
870
|
+
|
|
871
|
+
### Follow-up: cold-start investigation (v10.20.0)
|
|
872
|
+
Cold-start time on Windows measured at ~25s (24.2-28.5s observed across 10
|
|
873
|
+
runs, all paths including dist load, WASM grammars, LSP sidecar boot). Tracked
|
|
874
|
+
as separate work item for v10.20.0 — outside zombie-fix scope. Boot-time
|
|
875
|
+
control experiment confirmed the shutdown fix does not regress cold-start
|
|
876
|
+
(median 24.7s post vs 25.5s pre — within statistical noise).
|
|
877
|
+
|
|
878
|
+
## [10.18.1] - 2026-05-04
|
|
879
|
+
|
|
880
|
+
# v10.18.1 — Cache schema versioning + web-symbol normalization + sprint hygiene
|
|
881
|
+
|
|
882
|
+
Sprint focus: bug fixes, cache invalidation correctness, test isolation, and
|
|
883
|
+
documentation precision. Closes the migration TODO from v10.18.0
|
|
884
|
+
("schema-versioned cache invalidation shipping in v10.18.1") and the web-symbol
|
|
885
|
+
asymmetry between parser storage and edit lookup.
|
|
886
|
+
|
|
887
|
+
## Fixed
|
|
888
|
+
|
|
889
|
+
### `batch_edit` / `edit` symbol normalization on web files (CSS / HTML / JSON)
|
|
890
|
+
Asymmetric normalization: the parser stripped prefixes at chunk storage time
|
|
891
|
+
(`.` for CSS classes, `#` for IDs, quotes for JSON keys), but `semanticEdit`
|
|
892
|
+
and `batchSemanticEdit` matched against the raw caller-supplied symbol. LLM
|
|
893
|
+
callers sending `.className` or `"key"` now correctly match parser-stored
|
|
894
|
+
chunks. Also closes a key-leak in blast-radius detection where `oldRawCodes` /
|
|
895
|
+
`newRawCodes` were keyed off the normalized symbol while downstream lookups
|
|
896
|
+
used the raw input. (`59c3934`)
|
|
897
|
+
|
|
898
|
+
### Test isolation leak in router and backward-compat tests
|
|
899
|
+
Tests no longer pollute global state; previously-flaky tests now pass
|
|
900
|
+
deterministically. (`77ae56c`)
|
|
901
|
+
|
|
902
|
+
## Added
|
|
903
|
+
|
|
904
|
+
### Parser schema version gate for cache invalidation (`69e5acd`, `bb10bb4`)
|
|
905
|
+
Bumped `PARSER_SCHEMA_VERSION` to 2. Existing `.nreki.db` caches with v1 schema
|
|
906
|
+
are auto-wiped on next run, eliminating the manual `rm -rf .nreki .nreki.db`
|
|
907
|
+
step that v10.18.0 documented as a workaround. Includes characterization tests
|
|
908
|
+
covering version-gate transitions.
|
|
909
|
+
|
|
910
|
+
### `READ_ONLY_ACTIONS` whitelist in circuit breaker (`9717ce7`)
|
|
911
|
+
20 read-only actions skip the `containsError()` heuristic to prevent
|
|
912
|
+
false-positive doom-loop trips during normal navigation. `filter_output` is
|
|
913
|
+
deliberately excluded — it remains the primary gateway for detecting
|
|
914
|
+
test/build error loops. `response.isError === true` continues to trip the
|
|
915
|
+
breaker even on read-only actions (hardware signal vs heuristic).
|
|
916
|
+
|
|
917
|
+
### NREKI artifact exclusion from `DEFAULT_IGNORE` (`a50df2d`)
|
|
918
|
+
`**/.nreki/**` and `**/.nreki.db*` patterns now ignored by default. Critical
|
|
919
|
+
for upcoming corpus work — without this, NREKI re-indexed its own artifacts on
|
|
920
|
+
every repo it scanned.
|
|
921
|
+
|
|
922
|
+
## Changed
|
|
923
|
+
|
|
924
|
+
### Removed `nreki-enforcer` hook integration (`fe2c0d0`)
|
|
925
|
+
Cleanup of unused Claude hook. No functional impact on package consumers.
|
|
926
|
+
|
|
927
|
+
## Documentation
|
|
928
|
+
|
|
929
|
+
### Clarified v7.x spectral gap language in CHANGELOG (`2efa26a`)
|
|
930
|
+
"for predictive analysis" → "for spectral gap analysis" in the v7.x λ₃ entry.
|
|
931
|
+
AHI is a deterministic descriptive composite (percentile bucketing P20/P50/P80
|
|
932
|
+
over peer-group distribution), not a supervised classifier — phrasing aligned
|
|
933
|
+
with that design.
|
|
934
|
+
|
|
935
|
+
## Tests
|
|
936
|
+
|
|
937
|
+
- 909 passed | 1 skipped (893 base + 16 new from
|
|
938
|
+
`tests/web-symbol-normalization.test.ts`).
|
|
939
|
+
- `tsc --noEmit` clean.
|
|
940
|
+
|
|
941
|
+
## Compatibility
|
|
942
|
+
|
|
943
|
+
- **Recommended runtime: Claude Sonnet 4.6+** for 1M context window support.
|
|
944
|
+
The 1M context beta header was retired for Sonnet 4.5/4 on 2026-04-30;
|
|
945
|
+
NREKI's compression remains effective on 200k contexts but benefits more
|
|
946
|
+
from 1M.
|
|
947
|
+
- `@modelcontextprotocol/sdk` remains pinned at `1.23.1` (1.24.0+ injects
|
|
948
|
+
`execution: { taskSupport: 'forbidden' }` which breaks NREKI's tool
|
|
949
|
+
registration).
|
|
950
|
+
|
|
951
|
+
## [10.18.0] - 2026-05-02
|
|
952
|
+
|
|
953
|
+
# v10.18.0 — Schema compatibility + CSS parser + UX deadlock fix
|
|
954
|
+
|
|
955
|
+
## Fixed
|
|
956
|
+
|
|
957
|
+
### Critical: Schema break in strict MCP clients (Bloque A)
|
|
958
|
+
SDK MCP `@modelcontextprotocol/sdk` was silently resolving from `^1.12.1`
|
|
959
|
+
to `1.27.1` via `npx -y` distribution. Versions 1.24.0+ inject an
|
|
960
|
+
`execution.taskSupport: 'forbidden'` field in tool registrations that
|
|
961
|
+
strict MCP clients (Gemini CLI, Codex CLI) reject as non-spec, causing
|
|
962
|
+
NREKI tools to be silently dropped. Now pinned to `1.23.1` (last clean
|
|
963
|
+
version, verified empirically).
|
|
964
|
+
|
|
965
|
+
All other runtime dependencies pinned to current lockfile resolutions to
|
|
966
|
+
prevent recurrence:
|
|
967
|
+
- `@typescript-eslint/parser`, `chokidar`, `eslint`, `eslint-plugin-jsx-a11y`,
|
|
968
|
+
`eslint-plugin-react`, `eslint-plugin-react-hooks`, `picomatch`,
|
|
969
|
+
`web-tree-sitter`, `zod`, `@xenova/transformers`
|
|
970
|
+
- TypeScript peer dependency capped at `>=5.5.0 <6.0.0`
|
|
971
|
+
|
|
972
|
+
### Critical: P0 deadlock in Chronos + Cognitive Enforcer (Bug D reclassified)
|
|
973
|
+
Files marked HIGH friction by Chronos triggered an infinite loop:
|
|
974
|
+
1. Layer 2 (edit gate) blocks edit and instructs LLM to `read compress:false`
|
|
975
|
+
2. LLM obeys
|
|
976
|
+
3. Layer 1 (Cognitive Enforcer) blocks the raw read on >100 line files
|
|
977
|
+
4. Layer 2 keeps demanding raw read, Layer 1 keeps rejecting
|
|
978
|
+
5. Context budget exhausted
|
|
979
|
+
|
|
980
|
+
Fix: Layer 2 now emits the JSON-RPC tool call including
|
|
981
|
+
`_nreki_bypass:"chronos_recovery"` token that Layer 1 honors. Both
|
|
982
|
+
single-edit and batch-edit gates updated.
|
|
983
|
+
|
|
984
|
+
### CSS parser captures at-rules (Bloque C2)
|
|
985
|
+
Tree-sitter-css query previously only captured `rule_set` selectors,
|
|
986
|
+
making `@keyframes`, `@media`, `@import`, and `@font-face` blocks
|
|
987
|
+
invisible to the chunks index. `fast_grep` for at-rule strings returned
|
|
988
|
+
"No matches" even when present in source files.
|
|
989
|
+
|
|
990
|
+
Now captures 5 node types with `@symbol_name` binding:
|
|
991
|
+
- `rule_set` (regular CSS rules)
|
|
992
|
+
- `keyframes_statement` (`@keyframes`)
|
|
993
|
+
- `media_statement` (`@media`)
|
|
994
|
+
- `import_statement` (`@import`)
|
|
995
|
+
- `at_rule` (catch-all for `@font-face`, `@supports`, etc.)
|
|
996
|
+
|
|
997
|
+
### CSS focus normalization (Hallazgo Colateral)
|
|
998
|
+
Parser strips punctuation from selectors at extraction (`.foo` → `foo`),
|
|
999
|
+
but `compressor-foveal.ts` kept the user's focus raw. TFC-Pro silently
|
|
1000
|
+
failed to find `.home-sidebar` against the indexed `home-sidebar`. Now
|
|
1001
|
+
applies the same normalization to focus when the file is CSS or HTML.
|
|
1002
|
+
|
|
1003
|
+
### TFC-Pro returns discriminated union (Bloque C1)
|
|
1004
|
+
Previously returned `TfcResult | null` and emitted misleading
|
|
1005
|
+
"NOT FOUND or TOO LARGE (Density Shield)" which conflated two distinct
|
|
1006
|
+
cases. New `TfcResultPayload` type:
|
|
1007
|
+
- `{ kind: "success", data: TfcResult }`
|
|
1008
|
+
- `{ kind: "not_found" }` → "symbol X not found, run outline first"
|
|
1009
|
+
- `{ kind: "shield_tripped", ratio, ... }` → "focus spans >85% of file,
|
|
1010
|
+
use compress:false or omit focus"
|
|
1011
|
+
|
|
1012
|
+
### Multi-focus validation with domain shield (Bloque C3.A)
|
|
1013
|
+
Agents passing `focus="func1 func2 func3"` (space-separated) previously
|
|
1014
|
+
became a single token that never matched, returning generic "not_found".
|
|
1015
|
+
Now emits an educational error in non-web file types. CSS/HTML preserve
|
|
1016
|
+
multi-word selectors (e.g., `body .foo`).
|
|
1017
|
+
|
|
1018
|
+
## Migration notes
|
|
1019
|
+
|
|
1020
|
+
If upgrading from earlier versions and you observe that:
|
|
1021
|
+
- `fast_grep` returns no matches for CSS at-rules in projects you
|
|
1022
|
+
previously indexed
|
|
1023
|
+
- Indexed paths still point to old project locations (e.g., after
|
|
1024
|
+
moving the project to a different directory)
|
|
1025
|
+
|
|
1026
|
+
**Workaround:** delete the `.nreki/` directory and `.nreki.db` file from
|
|
1027
|
+
your project root to force reindex with the new parser.
|
|
1028
|
+
|
|
1029
|
+
```bash
|
|
1030
|
+
# Linux/Mac
|
|
1031
|
+
rm -rf .nreki/ .nreki.db
|
|
1032
|
+
|
|
1033
|
+
# Windows PowerShell
|
|
1034
|
+
Remove-Item -Recurse -Force .nreki, .nreki.db
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
A permanent migration mechanism (paths relative to projectRoot,
|
|
1038
|
+
schema-versioned cache invalidation) is shipping in v10.18.1.
|
|
1039
|
+
|
|
1040
|
+
## Known issues for v10.18.1
|
|
1041
|
+
|
|
1042
|
+
- Path stale: paths in `.nreki.db` and `.nreki/backups/` are stored
|
|
1043
|
+
absolute, breaking when projects are moved between directories.
|
|
1044
|
+
- 8 npm audit vulnerabilities in transitive dependencies (review case
|
|
1045
|
+
by case in v10.18.1).
|
|
1046
|
+
|
|
1047
|
+
## Dependencies
|
|
1048
|
+
|
|
1049
|
+
- `@modelcontextprotocol/sdk`: `^1.12.1` → `1.23.1` (pinned, downgrade)
|
|
1050
|
+
- All other runtime deps pinned to current lockfile resolutions
|
|
1051
|
+
- 9 commits in this release including 3 internal smoke tests as
|
|
1052
|
+
permanent regression tooling
|
|
1053
|
+
|
|
1054
|
+
## [10.17.0] - 2026-04-25
|
|
1055
|
+
|
|
1056
|
+
### Reliability pass: 6 critical bugs fixed
|
|
1057
|
+
|
|
1058
|
+
Pre-publish audit revealed 6 bugs in v10.16.x tags (never published to
|
|
1059
|
+
npm). All fixed in this release.
|
|
1060
|
+
|
|
1061
|
+
- **fix(parser)**: `.tsx` files now use dedicated tree-sitter-tsx
|
|
1062
|
+
grammar. Previously JSX caused 0 chunks, making React/Next/Remix
|
|
1063
|
+
components invisible to NREKI. `da8275e`
|
|
1064
|
+
- **fix(engine)**: File watcher auto-starts on boot. `fast_grep`
|
|
1065
|
+
bootstraps index on first call. chokidar config uses
|
|
1066
|
+
`ignoreInitial: true` and root-directory watching (required by
|
|
1067
|
+
chokidar@4, which dropped glob support) to prevent race with
|
|
1068
|
+
handler-side indexing. `77afbed`
|
|
1069
|
+
- **fix(parser)**: Top-level `const`/`let` declarations now indexed.
|
|
1070
|
+
Previously only arrow-function/function-expression constants
|
|
1071
|
+
captured. Config objects, lookup tables, hardcoded values now
|
|
1072
|
+
visible to fast_grep. `25287b2`
|
|
1073
|
+
- **fix(semantic-edit)**: `batch_edit` path keys normalized via
|
|
1074
|
+
`safePath()` for both stores and lookups, including hologram branch.
|
|
1075
|
+
Relative paths no longer silently skip blast radius detection.
|
|
1076
|
+
`907b7d2` + follow-up commit.
|
|
1077
|
+
- **fix(path-jail)**: Windows drive letter comparison case-insensitive.
|
|
1078
|
+
Lowercase `d:/` no longer blocked as traversal. Affects VSCode URIs,
|
|
1079
|
+
WSL symlinks, shell copy-paste. `9c346d9`
|
|
1080
|
+
- **fix(signature)**: `extractSignature` strips body from one-liner
|
|
1081
|
+
functions, cutting at `=>` or `{` at zero paren/angle depth. No more
|
|
1082
|
+
false positive blast radius on body-only edits. `76d778e`
|
|
1083
|
+
|
|
1084
|
+
### Performance improvements
|
|
1085
|
+
|
|
1086
|
+
Zero-allocation rewrite + FFI diet from abandoned v10.16.0 branch now
|
|
1087
|
+
published in this release:
|
|
1088
|
+
|
|
1089
|
+
- **perf(navigate)**: fast_grep O(L) pointer walk via `indexOf`
|
|
1090
|
+
(V8 memchr SIMD internally). Replaces per-hit allocations.
|
|
1091
|
+
- **perf(fast_grep)**: Lean SELECT (4 cols) reduces WASM-to-JS FFI
|
|
1092
|
+
decoding overhead. Legacy 10-col method removed (breaking for
|
|
1093
|
+
any hypothetical external consumer).
|
|
1094
|
+
|
|
1095
|
+
Combined benchmark delta on NREKI src/ (10 iter, median):
|
|
1096
|
+
- export (156 hits): 11.24ms -> 5.22ms (-54%)
|
|
1097
|
+
- findDefinition: 2.98ms -> 2.26ms (-24%)
|
|
1098
|
+
- chronosMemory: 2.16ms -> 1.73ms (-20%)
|
|
1099
|
+
- [OK]: 1.81ms -> 1.52ms (-16%)
|
|
1100
|
+
|
|
1101
|
+
### Multi-agent manifest
|
|
1102
|
+
|
|
1103
|
+
`nreki init` now generates CLAUDE.md + AGENTS.md + SKILL.md. All three
|
|
1104
|
+
share the IMMUNE SYSTEM operational rules: 80L Guillotine, Multi-patching
|
|
1105
|
+
ACID, Anti-Sweep Shield, TTRD Shield with CFI, Engrams with ASSERT prefix.
|
|
1106
|
+
Compatible with Claude Code, Codex, Gemini, and any MCP-capable agent.
|
|
1107
|
+
|
|
1108
|
+
### Tests
|
|
1109
|
+
|
|
1110
|
+
877 passing, 1 skipped (Linux-specific case-sensitivity test skipped on
|
|
1111
|
+
win32). +26 tests added across 6 bug fixes.
|
|
1112
|
+
|
|
1113
|
+
### Note on unreleased versions
|
|
1114
|
+
|
|
1115
|
+
v10.16.0 (`c08e61a`) and v10.16.1 (`ae9a526`) were git-tagged but never
|
|
1116
|
+
reached npm registry due to the 6 bugs above discovered in pre-publish
|
|
1117
|
+
audit. v10.17.0 is the next version reaching npm after v10.15.1.
|
|
1118
|
+
|
|
1119
|
+
## [10.16.1] - 2026-04-24
|
|
1120
|
+
|
|
1121
|
+
### Multi-agent manifest completion
|
|
1122
|
+
|
|
1123
|
+
- `nreki init` now also generates `SKILL.md` (completes the CLAUDE.md + AGENTS.md + SKILL.md trio). SKILL.md uses YAML frontmatter (`name: nreki-optimizer`) for Claude Code Skills system auto-discovery.
|
|
1124
|
+
- All three manifest files share the same IMMUNE SYSTEM operational rules: 80L Guillotine, Multi-patching ACID, Anti-Sweep Shield, TTRD Shield with CFI, Engrams with ASSERT prefix.
|
|
1125
|
+
- Cleanup: removed legacy `skills/SKILL.md` (orphan from pre-v10.12 era).
|
|
1126
|
+
|
|
1127
|
+
### Note on v10.16.0
|
|
1128
|
+
|
|
1129
|
+
v10.16.0 was tagged in git (`c08e61a`) but never published to npm. v10.16.1 is the first release of the v10.16.x line to reach the npm registry. Consumers should use 10.16.1 or later.
|
|
1130
|
+
|
|
1131
|
+
## [10.16.0] - 2026-04-24
|
|
1132
|
+
|
|
1133
|
+
### ⚡ Performance
|
|
1134
|
+
|
|
1135
|
+
- **fast_grep zero-allocation rewrite**: `handleFastGrep` now uses O(L) pointer walking with `indexOf()` (V8's memchr SIMD internally) instead of per-hit `substring()+split()` allocations.
|
|
1136
|
+
- **FFI diet SELECT**: `NrekiDB.fastGrep` now reads only 4 columns (path, raw_code, start_line, symbol_name) instead of 10, reducing WASM-to-JS decoding overhead by ~13%.
|
|
1137
|
+
|
|
1138
|
+
Combined benchmark delta on NREKI src/ (10 iter, median):
|
|
1139
|
+
- `export` (156 hits): 11.24ms → 5.22ms (−54%)
|
|
1140
|
+
- `findDefinition`: 2.98ms → 2.26ms (−24%)
|
|
1141
|
+
- `chronosMemory`: 2.16ms → 1.73ms (−20%)
|
|
1142
|
+
- `[OK]`: 1.81ms → 1.52ms (−16%)
|
|
1143
|
+
|
|
1144
|
+
Raw data: `scripts/benchmark-fastgrep-AFTER-patch.json`. Reproducible with `npx tsx scripts/benchmark-fastgrep.ts`.
|
|
1145
|
+
|
|
1146
|
+
### ⚠️ BREAKING CHANGES
|
|
1147
|
+
|
|
1148
|
+
- `NrekiDB.fastGrep()` return type changed from `ChunkRecord[]` (10 columns) to `FastGrepHit[]` (4 columns: path, raw_code, start_line, symbol_name). The legacy method has been removed.
|
|
1149
|
+
- Consumers relying on the full 10-column result (shorthand, node_type, defect_tags, external_refs, etc.) must use `NrekiDB.getChunkById()` or similar lookups for those fields.
|
|
1150
|
+
|
|
1151
|
+
### 📦 Multi-agent manifest
|
|
1152
|
+
|
|
1153
|
+
- `nreki init` now generates `CLAUDE.md` + `AGENTS.md` templates, enabling compatibility with Claude Code, Codex, Gemini, and other MCP-capable agents.
|
|
1154
|
+
- Templates reflect current NREKI features: 80L Guillotine, Multi-patching ACID, Anti-Sweep Shield, TTRD Shield with CFI, Engrams with ASSERT prefix, Go/Python LSP sidecars.
|
|
1155
|
+
|
|
1156
|
+
## [10.15.1] — 2026-04-24
|
|
1157
|
+
|
|
1158
|
+
### Multi-Agent Manifest
|
|
1159
|
+
|
|
1160
|
+
Docs-only patch. Rewrites the `nreki init` templates to reflect v10.15.0 features and adds an AGENTS.md template for non-Claude agent runtimes.
|
|
1161
|
+
|
|
1162
|
+
### Added
|
|
1163
|
+
|
|
1164
|
+
- **AGENTS.md template**: new `templates/AGENTS.md`, generated by `nreki init` alongside CLAUDE.md. Same body, header targeted at AI coding agents consuming NREKI via MCP (Codex, Gemini, others). `nreki deinit` cleans it.
|
|
1165
|
+
- **getAgentsMdContent()** helper + mirrored init/deinit blocks in src/index.ts. AGENTS.md is appended if the file exists without the NREKI marker, created fresh otherwise.
|
|
1166
|
+
|
|
1167
|
+
### Changed
|
|
1168
|
+
|
|
1169
|
+
- **CLAUDE.md template** rewritten as "NREKI ACTIVE (IMMUNE SYSTEM)" manifest with v10.15.0 features: `fast_grep` as the default exact-search tool, 80L guillotine for batch_edit payload decomposition, patch mode mandate for symbols >40 lines, ACID rules for multi-patching, TTRD (Type Discipline) bounties, engram memory anchoring.
|
|
1170
|
+
|
|
1171
|
+
### Notes
|
|
1172
|
+
|
|
1173
|
+
- No code/runtime behavior changes. Safe patch bump from v10.15.0. 845/845 tests pass unchanged.
|
|
1174
|
+
|
|
1175
|
+
## [10.15.0] — 2026-04-24
|
|
1176
|
+
|
|
1177
|
+
### Fast Path Navigator + Semantic Grep
|
|
1178
|
+
|
|
1179
|
+
Major navigation upgrade: findDefinition and findReferences now have a SQLite fast path that replaces the O(N) full-disk walk. New fast_grep action provides AST-aware substring search that returns topological coordinates (file + symbol + line + context) instead of raw grep output.
|
|
1180
|
+
|
|
1181
|
+
### Added
|
|
1182
|
+
|
|
1183
|
+
- **fast_grep action** (`nreki_navigate action:"fast_grep"`): exact substring search over AST chunks using SQLite INSTR. Returns each hit with the file path, containing AST symbol, exact line number, and line context. Multi-line queries supported — preview shows first line of the query, not the chunk. Designed to replace native grep for agent workflows where topological awareness matters.
|
|
1184
|
+
- **NrekiDB.getChunksBySymbolExact()**: SQLite lookup by symbol_name with optional COLLATE NOCASE fallback. Backed by new `idx_chunks_symbol_name` index.
|
|
1185
|
+
- **NrekiDB.fastGrep()**: SQLite INSTR-based substring search. Unlike LIKE, INSTR does not interpret wildcards (% and _), making it safe for arbitrary query text.
|
|
1186
|
+
- **stripCommentsAndStringsPreservingGeometry() helper**: neutralizes string/comment content in source files while preserving line/column geometry. Strings are zeroed FIRST, then comments — order matters to avoid "//" inside URL strings breaking the string regex.
|
|
1187
|
+
|
|
1188
|
+
### Changed
|
|
1189
|
+
|
|
1190
|
+
- **ast-navigator findDefinition and findReferences** gain an optional `engine` parameter. When provided, SQLite fast path resolves candidate chunks/files in O(log N) instead of walking the project. When omitted, original slow-path behavior is preserved exactly — all existing tests pass unchanged.
|
|
1191
|
+
- **findReferences regex**: replaced fragile inline character class with `escapeRegExp()` from utils/imports.js. The old pattern had ambiguous behavior for `[` characters.
|
|
1192
|
+
- **findReferences AST-light filter**: string literals and comments are now zeroed (preserving geometry) before the symbol regex runs. Eliminates false positives from matches inside strings or comments — e.g., a URL containing the symbol name no longer produces a reference hit.
|
|
1193
|
+
|
|
1194
|
+
### Notes
|
|
1195
|
+
|
|
1196
|
+
- Backward compatibility: 833/833 tests from v10.14.x baseline pass unchanged. 845/845 total with 12 new tests covering the fast path and fast_grep.
|
|
1197
|
+
- Performance (measured on NREKI codebase, `src/` only, 19 iterations per symbol, warm-up discarded):
|
|
1198
|
+
- **findDefinition**: slow path re-reads and re-parses all project files per call (~660ms on NREKI). Fast path hits the SQLite index directly (~0.2ms). Speedup: 2000–5000x. The large factor reflects that the slow path was I/O + parse-dominated; the fast path eliminates both.
|
|
1199
|
+
- **findReferences**: slow path walks all project files (~90ms on NREKI). Fast path restricts reads to SQLite-indicated candidates but still reads + regex-scans those files. Speedup: 6–19x depending on symbol commonality. Less dramatic because I/O is still proportional to matches.
|
|
1200
|
+
- Raw data: `scripts/benchmark-v10-15-0.json`. Reproducible with `npx tsx scripts/benchmark-v10-15-0.ts`.
|
|
1201
|
+
- fast_grep limit: minimum 3 chars per query, default 50 results, max 100.
|
|
1202
|
+
|
|
1203
|
+
### Acknowledgments
|
|
1204
|
+
|
|
1205
|
+
Cross-audit triangular: Claude verified the dormant NrekiDB infrastructure and designed the backward-compatible signature preservation; Pipipi Furia identified the O(N) disk walk, proposed the SQLite fast-path architecture, and caught the UX failure for multi-line fast_grep output; Antigravity executed the four-phase protocol with one abort-and-retry cycle (test fix) and rollback discipline throughout.
|
|
1206
|
+
|
|
1207
|
+
## [10.14.0] — 2026-04-22
|
|
1208
|
+
|
|
1209
|
+
### Multi-Patch Transactional batch_edit + Enforcer Hotfixes
|
|
1210
|
+
|
|
1211
|
+
Major feature: multiple patches to the same symbol are now allowed within a single `batch_edit` transaction, implemented via clustering + micro-splicing in RAM architecture. Bundled with enforcer hotfixes (F1 CSV focus, F2 passport persist, F3 win32 case-insensitive) identified during the v10.13.0 sprint retrospective. Cross-audit methodology: Claude + Pipipi Furia.
|
|
1212
|
+
|
|
1213
|
+
### Added
|
|
1214
|
+
|
|
1215
|
+
- **Block 3: Multi-Patch Transactional Architecture**: `batchSemanticEdit` now clusters edits by AST node identity (`chunk.startIndex`). Multiple patches to the same symbol are applied sequentially inside an isolated chunk string ("the Limbo"), then spliced back into the global file state in one atomic step. Enables refactors that previously required node-script bypasses (e.g., renaming a field that appears in non-contiguous regions of a single function).
|
|
1216
|
+
- **ACID pre-check**: each `search_text` in a multi-patch group must exist in the ORIGINAL chunk content. Prevents cross-patch corruption where a later patch anchors to content injected by an earlier one.
|
|
1217
|
+
- **Causal re-indent inheritance**: when a preceding patch alters indentation (e.g., wrapping code in try/catch), subsequent fuzzy-matched patches inherit the new indent via split/join preservation. Intentional — keeps sequential patches causally consistent.
|
|
1218
|
+
- **6 new tests** in `tests/batch-edit.test.ts` covering: happy multi-patch, ACID rejection, mixed-mode rejection, re-indent causal sequencing, per-iteration 80L cap enforcement, multi-chunk reverse-offset ordering.
|
|
1219
|
+
|
|
1220
|
+
### Fixed
|
|
1221
|
+
|
|
1222
|
+
- **F1 — CSV parse in `compress focus`**: `focus:"A, B, C"` was being stored as the literal string `"A, B, C"` in the passport's `focusedSymbols` Set, causing subsequent `.has("A")` lookups to fail. Split on comma and register each symbol individually.
|
|
1223
|
+
- **F2 — Passport persists post-edit**: removed aggressive decay (`focusedSymbols.delete` + `rawRead = false`) after successful `edit`/`batch_edit`. The agent retains in-context knowledge of symbols it just mutated; Layer 1 (AST sandbox), Layer 2 (TypeScript in RAM), and Cache Tickets already cover correctness and external-edit invalidation. Eliminates the recompress-after-every-edit loop that caused multi-step refactor deadlocks.
|
|
1224
|
+
- **F3 — Win32 path case-insensitive comparison in enforcer hook**: `path.resolve` does not normalize Windows drive-letter case (`D:/` vs `d:/`). The enforcer hook now compares paths case-insensitively on win32 only; POSIX behavior unchanged.
|
|
1225
|
+
|
|
1226
|
+
### Changed
|
|
1227
|
+
|
|
1228
|
+
- **Intra-chunk overlap detection** rewritten: instead of rejecting any two edits resolving to the same AST chunk, the enforcer now accepts multi-patch groups when all edits are `mode:"patch"` and `search_text` values pass the ACID pre-check.
|
|
1229
|
+
- **80L payload guillotine**: moved from pre-validation sweep to per-iteration check inside the Phase C micro-splice loop. Each patch in a multi-patch group is evaluated individually; the first patch exceeding 80L aborts the transaction.
|
|
1230
|
+
|
|
1231
|
+
### Notes
|
|
1232
|
+
|
|
1233
|
+
- Backward compatibility: 827/827 tests from v10.13.1 baseline pass unchanged. 833/833 total including the 6 new Block 3 tests.
|
|
1234
|
+
- `.claude/hooks/nreki-enforcer.mjs` and `.claude/settings.json` now tracked in git (previously untracked, which meant the enforcer was local-only to each developer). F3 is visible in the repo as of this release.
|
|
1235
|
+
|
|
1236
|
+
### Acknowledgments
|
|
1237
|
+
|
|
1238
|
+
Cross-audit triangular: Claude sourced code-level diagnostics and cross-audited the Block 3 architecture against the AST offset mismatch vector; Pipipi Furia confirmed root causes, proposed the clustering + micro-splicing design, and authored the initial test suite; Antigravity executed the multi-step protocol with hardened rollback discipline across the v10.13.1 hotfix and v10.14.0 feature release.
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
## [10.13.1] — 2026-04-22
|
|
1242
|
+
|
|
1243
|
+
### Enforcer Hotfix: CSV Parse + Passport Persistence
|
|
1244
|
+
|
|
1245
|
+
Hotfix addressing two deadlock sources in the Cognitive Enforcer identified during the v10.13.0 sprint retrospective. Cross-audit methodology: Claude + Pipipi Furia.
|
|
1246
|
+
|
|
1247
|
+
### Fixed
|
|
1248
|
+
|
|
1249
|
+
- **F1 — CSV parse in `compress focus`**: `focus:"A, B, C"` was being stored as the literal string `"A, B, C"` in the passport's `focusedSymbols` Set, causing subsequent `.has("A")` lookups to fail. Split on comma and register each symbol individually. Affects only multi-symbol compress calls.
|
|
1250
|
+
- **F2 — Passport persists post-edit**: removed aggressive decay (`focusedSymbols.delete` + `rawRead = false`) after successful `edit`/`batch_edit`. The agent retains in-context knowledge of symbols it just mutated; Layer 1 (AST sandbox), Layer 2 (TypeScript in RAM), and Cache Tickets already cover correctness and external-edit invalidation. Eliminates the recompress-after-every-edit loop that forced node-script bypasses during the v10.13.0 refactor sprint.
|
|
1251
|
+
|
|
1252
|
+
### Notes
|
|
1253
|
+
|
|
1254
|
+
- Both fixes are strictly more permissive than prior behavior. No regression surface for existing users.
|
|
1255
|
+
- Release test suite: 827/827 passing.
|
|
1256
|
+
- An additional hotfix (F3 — `win32` path case-insensitive comparison) was applied to `.claude/hooks/nreki-enforcer.mjs` in the working tree. That file is currently outside git tracking; a follow-up in v10.14.x will address tracking of `.claude/` enforcer assets.
|
|
1257
|
+
|
|
1258
|
+
### Acknowledgments
|
|
1259
|
+
|
|
1260
|
+
Cross-audit triangular: Claude sourced code-level diagnostics from the v10.13.0 sprint trace; Pipipi Furia confirmed root causes against the enforcer source and vetoed `mtime`-based invalidation in favor of passport persistence resting on the existing Cache Tickets infrastructure; Antigravity executed the protocol with hardened rollback discipline.
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
## [10.13.0] — 2026-04-22
|
|
1264
|
+
|
|
1265
|
+
### AHI Engine: Lanczos-PRO Transplant + Empirical Calibration
|
|
1266
|
+
|
|
1267
|
+
Major upgrade of the spectral analysis kernel, with empirical threshold
|
|
1268
|
+
calibration against Django STGT dataset (18,225 commits). Cross-audit
|
|
1269
|
+
methodology: Claude + Pipipi Furia + Antigravity.
|
|
1270
|
+
|
|
1271
|
+
### Added
|
|
1272
|
+
|
|
1273
|
+
- **Lanczos-PRO eigensolver** replacing power iteration in `SpectralMath.analyzeTopology`. Converges in ~20 SpMVs vs ~150 iterations. Performance: 2-8x faster on N>1000 graphs.
|
|
1274
|
+
- **Top-K eigenvalues exposure** in kernel return type (variable length, no zero-padding).
|
|
1275
|
+
- **Degenerate discriminated union variant** for highly symmetric graphs (K_n cliques where L|⊥ = n·I collapses Krylov to k=1).
|
|
1276
|
+
- **`vonNeumannEntropy` + `normalizedEigengap` pure functions** in `src/spectral/`.
|
|
1277
|
+
- **Eigengap Integrity** component in AHI (weight 0.05 deep mode). Thresholds `[3.69, 3.31, 2.69]` calibrated from Django STGT dataset.
|
|
1278
|
+
- **Markov Blanket localization** for eigengap_collapse issues (1-hop Ego-Graph around top-3 PageRank nodes).
|
|
1279
|
+
- **`engine_version` flag** in AuditReport for transparency across scoring engine updates.
|
|
1280
|
+
- **`scripts/calibrate-thresholds.py`** for reproducible empirical calibration.
|
|
1281
|
+
|
|
1282
|
+
### Fixed
|
|
1283
|
+
|
|
1284
|
+
- **B.1 Continuous reward gradient** in bucketScore: step-function cliff-drops replaced with linear interpolation. Prevents LLM agents from perceiving zero gradient on legitimate improvements (Pipipi Furia cross-audit).
|
|
1285
|
+
- **B.2 Mega-repo graceful degradation**: N>25000 returns `fiedler: undefined` and audit marks Spectral Integrity as unavailable instead of false "Toxic Monolith" verdict.
|
|
1286
|
+
- **B.3 Symmetric Ecosystem Percentile** for PageRank tier classification: `Math.log10(N/300)` scaling replaces static p85/p60. Stable across repo sizes (micro to mega).
|
|
1287
|
+
- **B.4 Chronos maturity gate**: Stability component requires ≥5 sessions before reporting (avoids false 10/10 on fresh NREKI installs in legacy codebases).
|
|
1288
|
+
|
|
1289
|
+
### Changed
|
|
1290
|
+
|
|
1291
|
+
- **Weight rebalance** in AHI: Spectral Integrity 0.25 → 0.20, new Eigengap Integrity 0.05. Total topological weight preserved at 0.25 (v10.12.0 baseline).
|
|
1292
|
+
- **Dual Laplacian analysis** in computeAudit: separate L_comb call for Spectral Integrity (historical semantics), L_sym call for Eigengap Integrity. ~2x Lanczos cost in explicit audit command (not hot-path).
|
|
1293
|
+
|
|
1294
|
+
### Deferred to v10.14.x
|
|
1295
|
+
|
|
1296
|
+
- **Spectral Entropy component**: empirical calibration revealed ±0.05 discrimination band (97.6% of values cluster in [0.80, 0.90]). Von Neumann over top-K=10 eigenvalues converges to near-uniform distribution in real codebases. Pure function preserved, component removed from AHI. Redesign candidates: full-spectrum entropy (O(N³) impractical), baseline-relative entropy vs Erdős-Rényi null, Inverse Participation Ratio (IPR) on Fiedler vector.
|
|
1297
|
+
- **Cross-ecosystem recalibration**: current thresholds biased toward Python/Django monolithic MVC architecture. Multi-ecosystem dataset generation (JS/TS/Rust/Python) planned.
|
|
1298
|
+
- **Chronos temporal KL-divergence** for architectural velocity (requires SQLite history infrastructure).
|
|
1299
|
+
|
|
1300
|
+
### Performance Notes
|
|
1301
|
+
|
|
1302
|
+
- Lanczos-PRO: net positive for N>1000 graphs. Negligible for N<500.
|
|
1303
|
+
- Dual Laplacian: audit command ~2x longer on mega-repos (N>10000). Hot-path `interceptAtomicBatch` unaffected.
|
|
1304
|
+
- AHI scores may shift for existing users due to weight rebalance and calibrated Eigengap. The `engine_version: "v10.13-spectral-enriched"` flag in AuditReport distinguishes engine update from architectural deterioration.
|
|
1305
|
+
|
|
1306
|
+
### Acknowledgments
|
|
1307
|
+
|
|
1308
|
+
1,114 backers whose crowdfunding supported this sprint. Cross-audit methodology by Pipipi Furia (local AI auditor on RX 580) validated kernel math, caught 5+ crimes in scoring logic, and derived empirical calibration against 18,225-commit STGT dataset.
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
## v10.12.0 — React/JSX Semantic Shield (Layer 1.5)
|
|
1312
|
+
|
|
1313
|
+
Community-funded release (1,114 backers via PayPal). Thank you for making this possible.
|
|
1314
|
+
|
|
1315
|
+
### Added
|
|
1316
|
+
- **React ESLint Sidecar**: automated detection of 4 critical React/JSX bug patterns during semantic-edit operations. The sidecar blocks the edit in RAM before disk commit when it detects:
|
|
1317
|
+
- `react-hooks/rules-of-hooks` — hooks called conditionally
|
|
1318
|
+
- `react-hooks/exhaustive-deps` — useEffect with incomplete dependency array
|
|
1319
|
+
- `react/jsx-key` — missing `key` prop in iterated elements
|
|
1320
|
+
- `jsx-a11y/alt-text` — `<img>` without `alt` attribute
|
|
1321
|
+
|
|
1322
|
+
The agent receives a pedagogical message with line/column/rule code and retries. No auto-healing — empirically confirmed that ESLint 9.39.4 does not provide auto-fix for these rules.
|
|
1323
|
+
|
|
1324
|
+
- **Anti-Sweep Shield for React rules**: rejects `eslint-disable` comments (both line `//` and JSX block `{/* */}`) targeting the 4 critical rules. Operates on the injected payload (not legacy file content), so existing files with pre-NREKI suppressions are not blocked from further edits. Tolerates comma-separated rule lists to prevent bypasses.
|
|
1325
|
+
|
|
1326
|
+
- **TypeScript parser integration**: `@typescript-eslint/parser` bundled for TSX files with `interface`, generics, and modern type annotations. Without it, the default parser would fatal-error on modern TypeScript React code.
|
|
1327
|
+
|
|
1328
|
+
- **`.mjs/.cjs/.mts/.cts` support in AST sandbox** (preexisting bug fix): these extensions were recognized by the tree-sitter parser since v10.10.0 but not by the AST sandbox, causing semantic-edit operations on those files to bypass syntax validation silently. Now fully aligned.
|
|
1329
|
+
|
|
1330
|
+
### Technical Details
|
|
1331
|
+
- Sidecar is lazy-initialized on first JSX/TSX mutation; zero cost for Python/Go/plain-TS users.
|
|
1332
|
+
- Hard cap of 150 KB per file as event loop starvation guard (ESLint is CPU-bound synchronous).
|
|
1333
|
+
- Timer cleanup via `finally { clearTimeout() }` prevents zombie timers in batch edits of 50+ files.
|
|
1334
|
+
- `lintTask.catch(() => {})` prevents `UnhandledPromiseRejection` if ESLint fails after timeout, which would kill the MCP server process.
|
|
1335
|
+
- Windows path normalization (backslash → forward slash) for picomatch glob matching in ESLint 9 Flat Config.
|
|
1336
|
+
- `settings: { react: { version: "18.3.1" } }` hardcoded to prevent `eslint-plugin-react` from writing warnings to stdout, which would corrupt the JSON-RPC stream.
|
|
1337
|
+
- In-process singleton with warm cache; subsequent edits on same file complete in ~12ms (5.9x speedup vs cold 75ms).
|
|
1338
|
+
|
|
1339
|
+
### Extension Support (per TC39 / TypeScript spec)
|
|
1340
|
+
- JSX (UI domain): `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs`. Empirically validated that `@typescript-eslint/parser` accepts JSX in these extensions.
|
|
1341
|
+
- Logic domain (Custom Hooks, rules-of-hooks, exhaustive-deps): applies to all 8 supported extensions including `.mts` and `.cts`.
|
|
1342
|
+
- Note: JSX is not spec-valid in `.mts`/`.cts` (TypeScript + CommonJS contexts). Parser will fatal-error on JSX in these files; the sidecar gracefully filters fatal errors via `msg.fatal` check and returns empty array. Validation of hooks in these files works correctly.
|
|
1343
|
+
|
|
1344
|
+
### Validated Empirically (pre-integration)
|
|
1345
|
+
- ESLint 9.39.4 `useEslintrc` API deprecation — confirmed breaks, removed from config.
|
|
1346
|
+
- Espree parser blindspot on TSX with types — fatal parse error on `interface`; `@typescript-eslint/parser` required.
|
|
1347
|
+
- `@typescript-eslint/parser` module shape — exposes named exports (no `.default`), loaded via namespace.
|
|
1348
|
+
- Latency baseline: 75ms cold / 12ms warm / 5.37ms clean. Sub-linear scaling (2.35x per 20x file size).
|
|
1349
|
+
- Plugin initialization: ~3.5s one-time cost when first JSX/TSX edit triggers the singleton; cached for subsequent edits in the same process lifetime.
|
|
1350
|
+
- Package tarball size confirms dependencies referenced (not bundled): ~870 kB vs 865 kB baseline.
|
|
1351
|
+
|
|
1352
|
+
### Triangle Audit Log (internal)
|
|
1353
|
+
This release was developed via three-way technical cross-audit:
|
|
1354
|
+
- Claude (Anthropic Opus 4.7): initial design + empirical diagnostic scripts + final architecture.
|
|
1355
|
+
- Pipipi (trained by maintainer): identified 5 critical architectural blind spots (Event Loop starvation, timer leaks, Anti-Sweep bypass on JSX block comments, stdout JSON-RPC contamination, fragment regex gap + modern extension coverage).
|
|
1356
|
+
- Maintainer (Jherson Tintaya): empirical verification of every hypothesis before code injection.
|
|
1357
|
+
|
|
1358
|
+
10 cross-audited fixes applied. Zero crimes shipped.
|
|
1359
|
+
|
|
1360
|
+
### Community
|
|
1361
|
+
Sprint funded by 1,114 backers via PayPal (April 20-22, 2026). Gracias enormes.
|
|
1362
|
+
|
|
1363
|
+
## v10.11.1 — Web Rescue Hotfix (CSS/HTML/JSON)
|
|
1364
|
+
|
|
1365
|
+
### Fixed
|
|
1366
|
+
- **Deadlock de edición cerrado para archivos web >100L.** Un usuario
|
|
1367
|
+
con `style.css` >100L quedaba atrapado: `nreki_code read` bloqueado
|
|
1368
|
+
por LEY 1, `nreki_code compress focus:"..."` respondía con el error
|
|
1369
|
+
mentiroso `TFC-Pro failed: NOT FOUND or TOO LARGE (Density Shield)`
|
|
1370
|
+
porque el parser ni soportaba `.css`, `WriteFile` nativo bloqueado
|
|
1371
|
+
por Capa 1, y `nreki_code edit` rechazado porque
|
|
1372
|
+
`semantic-edit.detectLanguage(".css") === null`. Ahora los 4 flancos
|
|
1373
|
+
se abren: parser nativo CSS/HTML/JSON, sandbox valida los 3,
|
|
1374
|
+
watcher indexa, semantic-edit los acepta, enforcer exime prosa sin
|
|
1375
|
+
AST (LEY 0.5), y el mensaje TFC-Pro distingue "lenguaje no soportado"
|
|
1376
|
+
de "símbolo no encontrado".
|
|
1377
|
+
|
|
1378
|
+
### Added
|
|
1379
|
+
- **Parsers tree-sitter WASM nativos para CSS/HTML/JSON.** Grammars
|
|
1380
|
+
bundleados desde `tree-sitter-wasms@0.1.13` vía
|
|
1381
|
+
`scripts/download-wasm.js`. Queries calibradas empíricamente contra
|
|
1382
|
+
fixtures reales (ver `scripts/diag-web-parsers.ts`):
|
|
1383
|
+
- CSS: captura `rule_set` con `selectors` normalizados (puntos,
|
|
1384
|
+
comas, hashes colapsados a espacios).
|
|
1385
|
+
- JSON: solo pairs top-level (doble anclaje `document > object >
|
|
1386
|
+
pair` en query + filtro AST en el loop) para evitar el blowup
|
|
1387
|
+
30→3 visto en lockfiles anidados.
|
|
1388
|
+
- HTML: elementos con atributo `id` o `class`, alternación
|
|
1389
|
+
`quoted_attribute_value | attribute_value` para soportar atributos
|
|
1390
|
+
sin comillas.
|
|
1391
|
+
- **LEY 0.5 — Exención quirúrgica de prosa.** `cognitive-enforcer.ts`
|
|
1392
|
+
ahora deja pasar `read` en archivos sin AST (`.md`, `.yaml`,
|
|
1393
|
+
`.toml`, `.sql`, `Dockerfile`, etc.) en lugar de crear un deadlock
|
|
1394
|
+
ineludible. TokenMonitor sigue como guillotina secundaria.
|
|
1395
|
+
- **OOM Parachute en `parser.ts`.** Si un archivo patológico genera
|
|
1396
|
+
>2000 chunks, el loop corta y loguea `warn`. Previene OOM en
|
|
1397
|
+
lockfiles o HTMLs masivos con patrones degenerados.
|
|
1398
|
+
- **Dedup por byte absoluto + symbolName** para JSON minificado y
|
|
1399
|
+
HTML multi-atributo. El `nodeKey` antiguo
|
|
1400
|
+
(`startPosition.row:endPosition.row`) colapsaba 4 pairs top-level a
|
|
1401
|
+
1 en JSON de una línea. El nuevo (`startIndex:endIndex:symbolName`
|
|
1402
|
+
en extensiones web) preserva cada captura distinguible.
|
|
1403
|
+
|
|
1404
|
+
### Changed
|
|
1405
|
+
- `scripts/download-wasm.js` ahora incluye `tree-sitter-css.wasm`,
|
|
1406
|
+
`tree-sitter-html.wasm`, `tree-sitter-json.wasm` en `NEEDED`.
|
|
1407
|
+
- `src/engine.ts` `DEFAULT_EXTENSIONS`, `src/ast-navigator.ts` y
|
|
1408
|
+
`src/repo-map.ts` `SUPPORTED_EXTENSIONS`, `src/ast-sandbox.ts`
|
|
1409
|
+
`LANGUAGE_MAP` + `EXT_TO_LANGUAGE`, `src/semantic-edit.ts`
|
|
1410
|
+
`detectLanguage` — todos extendidos con `.css`/`.json`/`.html`.
|
|
1411
|
+
- `src/handlers/code/read.ts` — cuando `tfcCompress` devuelve null,
|
|
1412
|
+
ahora consulta `engine.getParser().isSupported(ext)` antes de
|
|
1413
|
+
retornar el mensaje de Density Shield. Si el lenguaje no está
|
|
1414
|
+
soportado, retorna mensaje honesto que habilita `action:"read"`.
|
|
1415
|
+
|
|
1416
|
+
### Tests
|
|
1417
|
+
- Nuevo archivo `tests/parser-web.test.ts` con 5 tests de regresión
|
|
1418
|
+
(selectores CSS, atributos HTML unquoted + multi-attr, JSON
|
|
1419
|
+
minificado multi-pair, JSON top-only, sandbox valida los 3). Todos
|
|
1420
|
+
verdes.
|
|
1421
|
+
- `tests/ast-sandbox.test.ts` línea 261: assertion
|
|
1422
|
+
`sandbox.detectLanguage("styles.css")` migra de `toBeNull()` a
|
|
1423
|
+
`toBe("css")`.
|
|
1424
|
+
- Total suite: 802/802 pass (797 previos + 5 nuevos).
|
|
1425
|
+
|
|
1426
|
+
## v10.11.0 — Python Auto-Healing via basedpyright
|
|
1427
|
+
|
|
1428
|
+
### Added
|
|
1429
|
+
- **Python auto-healing now works** by switching the LSP engine to
|
|
1430
|
+
basedpyright (fork of pyright that exposes auto-import quickfix
|
|
1431
|
+
codeActions via standard LSP). When a user writes
|
|
1432
|
+
`result = datetime.now()` without importing datetime, NREKI now
|
|
1433
|
+
applies `from datetime import datetime` atomically in RAM before
|
|
1434
|
+
the edit commits. Matches TypeScript auto-healing experience
|
|
1435
|
+
("feels like TS" — resolving reported user feedback).
|
|
1436
|
+
- **Graceful fallback to pyright**: If basedpyright is not installed,
|
|
1437
|
+
the sidecar falls back to pyright-langserver (validation only, no
|
|
1438
|
+
healing) and emits a warning with install instructions. Zero
|
|
1439
|
+
regression for users who have only pyright.
|
|
1440
|
+
- **Anti-Sweep Shield in LSP healer**: The codeAction filter now
|
|
1441
|
+
explicitly rejects suppression-style actions (`# pyright: ignore`,
|
|
1442
|
+
`# noqa`, disable/suppress patterns) that would silence errors
|
|
1443
|
+
rather than fix them. Previously "Add `# pyright: ignore[...]`"
|
|
1444
|
+
would pass the filter because its title contains "add " — critical
|
|
1445
|
+
architectural risk closed.
|
|
1446
|
+
|
|
1447
|
+
### Changed
|
|
1448
|
+
- `python-sidecar.ts` now detects basedpyright availability at boot
|
|
1449
|
+
(synchronous check with 3s timeout) and chooses the appropriate
|
|
1450
|
+
LSP server.
|
|
1451
|
+
- Log output now shows which LSP engine was activated:
|
|
1452
|
+
`"Python project detected. basedpyright-langserver sidecar registered."`
|
|
1453
|
+
- Detection of basedpyright now passes a single-string command
|
|
1454
|
+
(`"basedpyright --version"`) with `shell: true` to `spawnSync`.
|
|
1455
|
+
This resolves the Windows `.cmd` shim (npm installs basedpyright
|
|
1456
|
+
as `basedpyright.cmd`, and Node 18+ blocks direct `.cmd` spawn
|
|
1457
|
+
under CVE-2024-27980) while avoiding the `DEP0190` deprecation
|
|
1458
|
+
warning that fires when combining `shell: true` with an args
|
|
1459
|
+
array. Without this, Windows users (majority of NREKI user base)
|
|
1460
|
+
would silently fall back to pyright without auto-healing.
|
|
1461
|
+
- `LspSidecarBase.boot()` now conditionally enables `shell: true`
|
|
1462
|
+
on Windows when `command[0]` is a bare binary name (no path
|
|
1463
|
+
separator). Required because the langserver spawn — not just
|
|
1464
|
+
detection — hits the same CVE-2024-27980 block when launching
|
|
1465
|
+
`.cmd` shims. Scoped to bare names so absolute paths with spaces
|
|
1466
|
+
(e.g. `C:\Program Files\nodejs\node.exe` in mock sidecars) still
|
|
1467
|
+
spawn directly without shell-concat breakage. Empirical verification
|
|
1468
|
+
via `scripts/verify-basedpyright-spawn.ts` confirms
|
|
1469
|
+
basedpyright-langserver now boots successfully on Windows (was
|
|
1470
|
+
failing with ENOENT pre-fix).
|
|
1471
|
+
|
|
1472
|
+
### Tests
|
|
1473
|
+
- New test: `Anti-Sweep shield rejects suppression CodeActions
|
|
1474
|
+
(ignore/noqa)` in tests/healer-atomic.test.ts. Total: 797 pass.
|
|
1475
|
+
|
|
1476
|
+
### Installation
|
|
1477
|
+
For Python auto-healing, install basedpyright globally:
|
|
1478
|
+
|
|
1479
|
+
npm install -g basedpyright
|
|
1480
|
+
|
|
1481
|
+
If already installed with pyright and conflicts occur:
|
|
1482
|
+
|
|
1483
|
+
npm install -g basedpyright --force
|
|
1484
|
+
|
|
1485
|
+
### Version numbering note
|
|
1486
|
+
Version 10.9.0 was reserved earlier for this release but skipped
|
|
1487
|
+
during the v10.10.0 (multi-language parser) sprint. Jumping directly
|
|
1488
|
+
to 10.11.0 to keep monotonic versioning.
|
|
1489
|
+
|
|
1490
|
+
## v10.10.0 — Multi-language parser extensions + Python namespace inference
|
|
1491
|
+
|
|
1492
|
+
### Added
|
|
1493
|
+
- **Modern JS/TS extensions (.mjs, .cjs, .mts, .cts)** now fully
|
|
1494
|
+
supported across parser, repo-map (PageRank graph), ast-navigator,
|
|
1495
|
+
and imports extractor. Previously invisible to dependency graph.
|
|
1496
|
+
- **Python flat imports** (`import X`, `import X.Y as Z`,
|
|
1497
|
+
comma-separated `import A, B, C`) now extracted with alias
|
|
1498
|
+
resolution.
|
|
1499
|
+
- **Python namespace inference engine**: `import django.db.models as
|
|
1500
|
+
db_models` followed by `db_models.Model` in body now correctly
|
|
1501
|
+
extracts `Model` as symbol with `models` as pathHint, mirroring
|
|
1502
|
+
the existing Go namespace-to-symbol pattern.
|
|
1503
|
+
- **Token-budget shield for Python stdlib**: imports from os, sys,
|
|
1504
|
+
re, json, time, math, datetime, typing, collections, itertools,
|
|
1505
|
+
pathlib, functools, abc, asyncio, logging, copy, enum, hashlib,
|
|
1506
|
+
random, string, threading, warnings, io are skipped from
|
|
1507
|
+
auto-context injection. LLMs already know stdlib — injecting
|
|
1508
|
+
signatures wastes tokens.
|
|
1509
|
+
|
|
1510
|
+
### Notes
|
|
1511
|
+
- v10.9.0 reserved for Python auto-healing (pyright codeAction
|
|
1512
|
+
diagnostic + implementation). This release is a prerequisite:
|
|
1513
|
+
auto-context now correctly feeds Python symbols to the model.
|
|
1514
|
+
- Zero regression in existing TS/JS/Go tests.
|
|
1515
|
+
|
|
1516
|
+
## v10.8.0 — Polyglot Kernel Fix
|
|
1517
|
+
|
|
1518
|
+
### Fixed
|
|
1519
|
+
- **Kernel and LSP sidecars now activate for Python-only and
|
|
1520
|
+
Go-only projects.** Previously, `detectMode()` counted only
|
|
1521
|
+
TS/JS files and returned "syntax" for Python/Go-only projects,
|
|
1522
|
+
preventing kernel boot and sidecar (pyright/gopls) registration.
|
|
1523
|
+
Users reported that Python and Go "didn't feel like TS" because
|
|
1524
|
+
the kernel never ran.
|
|
1525
|
+
- `TsCompilerWrapper.initConfig()` now degrades gracefully when no
|
|
1526
|
+
`tsconfig.json`/`jsconfig.json` is found, initializing minimal
|
|
1527
|
+
`compilerOptions` so the VFS and LSP sidecars can boot without
|
|
1528
|
+
the TypeScript compiler crashing. The TS backend stays idle
|
|
1529
|
+
while language-specific validation flows through sidecars.
|
|
1530
|
+
- Kernel activation no longer requires `tsconfig.json`. Project
|
|
1531
|
+
markers `pyproject.toml`, `requirements.txt`, `setup.py`,
|
|
1532
|
+
`Pipfile`, `go.mod`, and `jsconfig.json` also trigger kernel
|
|
1533
|
+
boot.
|
|
1534
|
+
|
|
1535
|
+
### Changed
|
|
1536
|
+
- Test `"should throw if tsconfig.json is missing"`
|
|
1537
|
+
(tests/nreki-kernel.test.ts) updated to assert the new
|
|
1538
|
+
polyglot fallback contract. Obsolete contract (throw on missing
|
|
1539
|
+
tsconfig) replaced with graceful boot assertion.
|
|
1540
|
+
|
|
1541
|
+
### Notes
|
|
1542
|
+
- Pure TS/JS projects retain exact previous behavior. Zero
|
|
1543
|
+
regression in existing test suite (794/794 pass).
|
|
1544
|
+
- This fix is a prerequisite for v10.9.0 (Python auto-healing):
|
|
1545
|
+
with the kernel now active for Python/Go projects, the next
|
|
1546
|
+
step is diagnosing pyright's LSP codeAction behavior to enable
|
|
1547
|
+
cross-language auto-heal.
|
|
1548
|
+
|
|
1549
|
+
## v10.7.5 — Safe Uninstall Hotfix (P0 security fix)
|
|
1550
|
+
|
|
1551
|
+
### Fixed
|
|
1552
|
+
- **CRITICAL**: Added `npx @ruso-0/nreki deinit` command. Users who
|
|
1553
|
+
previously ran `init` and then tried to `npm uninstall` would have
|
|
1554
|
+
their Claude Code environment broken because the PreToolUse hooks in
|
|
1555
|
+
`.claude/settings.json` would reference a deleted
|
|
1556
|
+
`nreki-enforcer.mjs` script, blocking all native Read/Write/Edit
|
|
1557
|
+
operations. Running `npx @ruso-0/nreki deinit` BEFORE `npm uninstall`
|
|
1558
|
+
cleanly removes all NREKI hooks, restoring native tools.
|
|
1559
|
+
|
|
1560
|
+
### Changed
|
|
1561
|
+
- `--help` output updated to document the new `deinit` subcommand.
|
|
1562
|
+
|
|
1563
|
+
### Notes
|
|
1564
|
+
- This is a hotfix. Multi-client `init` support (Cursor, Windsurf,
|
|
1565
|
+
Copilot, Cline, Codex) is planned for v10.8.0.
|
|
1566
|
+
|
|
1567
|
+
## [10.7.4] - 2026-04-18
|
|
1568
|
+
|
|
1569
|
+
### Changed
|
|
1570
|
+
- Landing GIF rebuilt with cinematic pacing: line-by-line reveal, dramatic pauses before timing reveals (the `48ms` outline, the `67ms` Fiedler on 116 files). Total runtime 14.6s, 98 keyframes. Previous 10.7.3 GIF dumped all output in a single frame and looked static; this version reads like a live session an agent would actually experience.
|
|
1571
|
+
|
|
1572
|
+
### Notes
|
|
1573
|
+
Docs-only release. Library behavior identical to 10.7.1.
|
|
1574
|
+
|
|
1575
|
+
## [10.7.3] - 2026-04-18
|
|
1576
|
+
|
|
1577
|
+
### Fixed
|
|
1578
|
+
- Landing-page asset swapped from SVG to GIF: npmjs.com blocks inline SVG rendering in READMEs (XSS policy), so the animated SVG shipped in 10.7.2 appeared as a broken image on the package page. `docs/demo.gif` (290 KB, 39 frames, generated by `agg` from the asciinema cast) now renders on both GitHub and npmjs.com.
|
|
1579
|
+
|
|
1580
|
+
### Notes
|
|
1581
|
+
Docs-only release. Library behavior identical to 10.7.1.
|
|
1582
|
+
|
|
1583
|
+
## [10.7.2] - 2026-04-18
|
|
1584
|
+
|
|
1585
|
+
### Fixed
|
|
1586
|
+
- README landing image now resolves. Previous `docs/demo.gif` was never generated; replaced with `docs/demo.svg` (animated SVG, 42 KB, renders on both GitHub and npmjs.com).
|
|
1587
|
+
- Normalized em-dashes (`—`) to plain hyphens (`-`) in the README for consistent rendering across terminals and fonts that lack the Unicode glyph.
|
|
1588
|
+
|
|
1589
|
+
### Notes
|
|
1590
|
+
Docs-only release. No code changes. Library behavior identical to 10.7.1.
|
|
1591
|
+
|
|
1592
|
+
## [10.7.1] - 2026-04-18
|
|
1593
|
+
|
|
1594
|
+
### Fixed
|
|
1595
|
+
- **Critical cache miss bug in edit validation warm path**: `engine.cachedGraph` was never populated during warmup (`getRepoMap` did not set it, only `getDependencyGraph` did). Additionally, the FSWatcher invalidated the cache indiscriminately after any internal edit, forcing a full repo reparse (~70s on VSCode-scale codebases, 5,584 files).
|
|
1596
|
+
|
|
1597
|
+
### Added
|
|
1598
|
+
- Cryptographic edit tickets (SHA-256) in `NrekiEngine` to distinguish internal edits (NREKI writes) from external changes (human, git, linter, auto-healer). Only external changes invalidate the topology cache.
|
|
1599
|
+
- `topologyChanged` detection in `semanticEdit` and `batchSemanticEdit` using AST signature change + import/export diff. Selective cache invalidation only when the edit actually changes topology.
|
|
1600
|
+
- Dynamic imports (`import("...")`) and side-effect imports (`import "module";`) now detected by `extractImports`.
|
|
1601
|
+
- OOM guard on ticket map (max 100 entries, FIFO eviction).
|
|
1602
|
+
- `engine.invalidateCachedGraph()` public method for explicit invalidation.
|
|
1603
|
+
- 6 new tests in `tests/cache-tickets.test.ts` covering cache persistence, invalidation on import changes, ticket rollback cleanup, external modification detection, OOM guard, and SQLite index freshness.
|
|
1604
|
+
|
|
1605
|
+
### Changed
|
|
1606
|
+
- `engine.getRepoMap()` now populates `cachedGraph` as side effect on warmup (fix for cold-boot cache miss).
|
|
1607
|
+
- `processQueue` always calls `indexFile` to keep SQLite/BM25 search index synchronized, even for internal edits.
|
|
1608
|
+
|
|
1609
|
+
### Performance
|
|
1610
|
+
Warm edits on VSCode-scale codebase (5,584 files):
|
|
1611
|
+
- Before: ~39-74s per edit (full repo reparse on every edit)
|
|
1612
|
+
- After: ~17ms median for edits without import changes (2,254x improvement)
|
|
1613
|
+
- Edits that change imports/exports trigger legitimate regeneration (~56-70s, one-time)
|
|
1614
|
+
|
|
1615
|
+
Benchmark methodology: 5 edits on microsoft/vscode with cold warmup. Results reproducible via the instrumented benchmark wrapper. See `D:\bench\results\nreki-v10.7.1-fix-benchmark-2026-04-18.json`.
|
|
1616
|
+
|
|
1617
|
+
### Tests
|
|
1618
|
+
- 789 tests passing (783 pre-existing + 6 new cache-tickets tests)
|
|
1619
|
+
- Zero-any discipline preserved
|
|
1620
|
+
- No regressions
|
|
1621
|
+
|
|
1622
|
+
## 10.7.0 (2026-04-17) — The NREKI Way
|
|
1623
|
+
|
|
1624
|
+
NREKI stops acting like a passive guard and starts acting like an immune system. The LLM is now surrounded by parasitic signals that cost nothing per call but continuously shape its behavior toward discipline. Four features ship in one minor bump.
|
|
1625
|
+
|
|
1626
|
+
### Added
|
|
1627
|
+
- **Parasitic Defect Radar.** Four regex-based inline detectors run during `outline` on `sym.body`, tagging symbols with `⚠️ [label,...]` when LLM rush signals are detected: `swallowed-error` (empty catch), `type-escape-any` (any escape — anchored to avoid JSX false positives), `ts-suppress` (`@ts-ignore` / `@ts-expect-error` / `@ts-nocheck`), `non-null-assert` (`value!.method()` — anchored to skip `!==`). Zero additional tokens consumed — tags ride the outline header that's already emitted. Microsecond latency per symbol. Escape hatch: a `// nreki-hunt: disable` comment anywhere in the body zeros out all detections for that symbol.
|
|
1628
|
+
- **Symbol-level Ghost Oracle.** Exported symbols with 0 external references are tagged `👻 [0 ext refs]` in outline. Entry files (`index.*`, `main.*`, `app.*`, `setup.*`, `server.*`, `cli.*`, `vite-env.*`, `*.config.*`, `*.test.*`, `*.spec.*`) are excluded — they're referenced by runtimes and test-runners, not by the import graph. Pre-fetched via `Promise.all` over unique names so the LSP-backed lookup can parallelize when it becomes truly async (currently `engine.searchFilesBySymbol` is an async wrapper over sync `NrekiDB.searchRawCode` — future-proof shape).
|
|
1629
|
+
- **Executable Engrams (immortal ASSERT).** Engrams whose `insight` starts with `ASSERT` (case-insensitive) survive AST-hash mutation — they remain pinned to the symbol across edits. Regular engrams still invalidate on mutation as before. No DSL, just English — the LLM reads and respects. Use it to pin invariants about a symbol's role or contract that transcend the body's implementation.
|
|
1630
|
+
- **TTRD Bounties (quantified).** Successful restoration of strict types now reports the exact CFI discount to the LLM via `[TTRD BOUNTY] TYPE DEBT PAID 🏆` feedback: `File friction score (CFI) reduced by N.N points. Excellent engineering.` Pavlovian reinforcement loop closed — the LLM learns that narrowing types produces a measurable reward, not a token of praise.
|
|
1631
|
+
|
|
1632
|
+
### Changed
|
|
1633
|
+
- [handleOutline](src/handlers/navigate.ts) now renders defect tags, ghost tags, and immortal ASSERT engrams inline alongside the existing risk tags. The LOW-risk skip is extended so any symbol flagged with defects or a ghost tag stays visible.
|
|
1634
|
+
- [kernel-bridge.ts](src/handlers/code/kernel-bridge.ts) TTRD feedback now quantifies CFI reduction (via `getFileCFI` before/after) instead of emitting a generic "debt paid" message.
|
|
1635
|
+
|
|
1636
|
+
### Tests
|
|
1637
|
+
- +7 unit tests for [defect-radar.ts](tests/defect-radar.test.ts) (detector coverage + false-positive guards + escape-hatch).
|
|
1638
|
+
- +5 integration tests for [handleOutline](tests/navigate.test.ts) (ghost oracle + entry-file exemption + immortal ASSERT survival + regular engram invalidation + case-insensitivity). Real `NrekiEngine`, temp projects, no mocks.
|
|
1639
|
+
- Total: 783/783 across 54 files. Zero regressions.
|
|
1640
|
+
|
|
1641
|
+
### Internal
|
|
1642
|
+
- Zero new `any` introduced. Residue grep shows only the 6 known cosmetic hits from v10.6.1 (JSDoc in shadow-generator, one codegen string literal, and three descriptive comments).
|
|
1643
|
+
|
|
1644
|
+
### Philosophy
|
|
1645
|
+
> NREKI now acts less like a passive guard and more like an immune system. The LLM is surrounded by parasitic signals that cost nothing per call but continuously shape its behavior toward discipline.
|
|
1646
|
+
|
|
1647
|
+
## 10.6.1 (2026-04-17) — Zero-any Discipline Milestone
|
|
1648
|
+
|
|
1649
|
+
Five bisectable commits eliminating every semantic `any` usage from first-party TypeScript code. Pure refactor — no behavior change, no new tests, no regressions.
|
|
1650
|
+
|
|
1651
|
+
### Refactor
|
|
1652
|
+
- **`sql.js.d.ts`** — 7 `any` usages replaced with the canonical SQLite type union `SqlValue = string | number | boolean | Uint8Array | null`. All call sites in `src/database.ts` already pass only `string` / `number` / `number[]` / `string[]`, all within the union — zero adjustments needed downstream.
|
|
1653
|
+
- **`lsp-sidecar-base.ts`** — two `as any` casts on JSON-RPC responses replaced with minimal protocol interfaces: `LspProtocolInitializeResult` (reads only `capabilities.diagnosticProvider` + `serverInfo`) and `LspProtocolDiagnosticResult` (reuses existing `LspDiagnostic` via `items?: LspDiagnostic[]`).
|
|
1654
|
+
- **`cognitive-enforcer.ts`** — `evaluate` and `registerSuccess` both take `EnforcerInput` instead of `any`. Per-edit shape declared inline on `EnforcerInput.edits[]` and reused via `NonNullable<EnforcerInput["edits"]>[number]` in `validateSingleBatchEdit` (replaces the earlier `Partial<BatchEditOp>` typing, which was strict-narrow and clashed with the wider `CodeParams.edits[].mode: string` that the router passes down). Unused `BatchEditOp` import removed.
|
|
1655
|
+
- **`ts-compiler-wrapper.ts`** — `(this.host as any).getModifiedTime = ...` replaced with a local `CompilerHostWithMtime = ts.CompilerHost & { getModifiedTime?: (fileName: string) => Date }` type alias. `getModifiedTime` is defined on `ts.ModuleResolutionHost` (which `ts.CompilerHost` structurally extends) but isn't a required member — the alias makes the monkey-patch type-visible.
|
|
1656
|
+
- **`index.ts`** — CLI init settings block now typed via `ClaudeSettings` interface. `JSON.parse` cast to `unknown` first, narrowed via `typeof parsed === "object"` guard, then asserted to `ClaudeSettings`. `(h: any) => h.matcher` callback's parameter now inferred from array element type.
|
|
1657
|
+
|
|
1658
|
+
### Residual
|
|
1659
|
+
Six `any` mentions remain in `src/`, all non-semantic:
|
|
1660
|
+
- Three in `shadow-generator.ts` — JSDoc prose + one codegen string literal (emits `": any"` into generated `.d.ts` when no type can be inferred).
|
|
1661
|
+
- Two in `nreki-kernel.ts` comments describing test-access patterns and an earlier v10.5.9 removal.
|
|
1662
|
+
- One in `ts-compiler-wrapper.ts` comment describing the v10.6.1 replacement above.
|
|
1663
|
+
|
|
1664
|
+
### Tests
|
|
1665
|
+
- 771/771 pass (52 files). Zero new tests required (pure refactor). Zero regressions.
|
|
1666
|
+
|
|
1667
|
+
## 10.6.0 (2026-04-17) — Wave 3 Polish (Patch 6)
|
|
1668
|
+
|
|
1669
|
+
Two bundled fixes in the hologram subsystem. Low-severity but long-overdue.
|
|
1670
|
+
|
|
1671
|
+
### Correctness
|
|
1672
|
+
- **shadow-generator escape-loop fixed in 3 functions** (`stripParameterDefaults`, `splitAndCleanParams`, `cleanSingleParam`). The heuristic `sig[i-1] !== "\\"` misread strings ending in an escaped backslash pair (e.g. `"C:\\"`): the final `\` was read as escaping the closing quote, so the parser kept running INSIDE the string past its actual terminator. Windows paths, escape sequences, and any string literal ending in `\\` silently corrupted the generated `.d.ts` — parameter lists bled into return types. Replaced with the canonical skip-next-char pattern that the peer `splitParams` already used.
|
|
1673
|
+
|
|
1674
|
+
### Performance
|
|
1675
|
+
- **harvester drain loop uses native iterator** instead of `Array.from(this.queue).slice(0, BATCH_SIZE)`. Pre-fix allocated a full copy of the queue Set on every drain cycle: O(N) per batch, O(N²/BATCH_SIZE) total across a drain. At 5k queued files that adds up to millions of wasted allocations. Post-fix: native iterator that stops after `BATCH_SIZE`, no Set copy. Two-phase collect-then-delete preserves original semantics.
|
|
1676
|
+
|
|
1677
|
+
### Tests
|
|
1678
|
+
- 771/771 pass (52 files): 765 from v10.5.9 + 6 new in `tests/hologram-shadow-escape.test.ts` covering Windows-path defaults, backslash-terminated strings followed by more params, cleanSingleParam `=` seek, backtick templates, return-type preservation, and a no-default regression guard.
|
|
1679
|
+
- Existing 6/6 harvester tests still green (drain behavior unchanged externally; only the inner loop pattern differs).
|
|
1680
|
+
|
|
1681
|
+
### End of Round-5 audit execution
|
|
1682
|
+
With v10.6.0 shipped, all 6 patches from the round-5 audit of v10.5.1 are now in master: Patch 1 (enforcer bypass, v10.5.7), Patch 2 (`$` substitution, v10.5.7), Patch 3 (saveBackup OOM, v10.5.7), Patch 2 auto-infer + Patch 3 tolerant-patch (v10.5.8), Patch 5 (LSP healer atomic, v10.5.9), Patch 6 (shadow-gen + harvester, v10.6.0). Each shipped in its own bisectable commit.
|
|
1683
|
+
|
|
1684
|
+
## 10.5.9 (2026-04-17) — LSP Auto-Healer Atomic Multi-TextEdit (Wave 2, Patch 5)
|
|
1685
|
+
|
|
1686
|
+
Single-patch release. Fixes the doom-loop that occurred whenever an LSP quickfix required coupled edits (e.g., gopls "organize imports" that inserts the import block AND updates a usage, or pyright `from X import Y` plus a reference fix). The healer previously applied only one TextEdit per CodeAction; the other error stayed live, validation rolled back, and the agent retried forever.
|
|
1687
|
+
|
|
1688
|
+
### Correctness
|
|
1689
|
+
- **`requestCodeActions` returns `LspCodeAction[]`** instead of a flat TextEdit array. Each action carries its full `edits[]` so the kernel can treat one CodeAction as one logical fix.
|
|
1690
|
+
- **`attemptLspAutoHealing` applies every TextEdit of the chosen CodeAction atomically.** New helper `applyCodeActionEdits` groups edits by resolved file path, creates savepoints for ALL affected files before any apply, and applies each file's edits bottom-up (descending `startLine`/`character`) so earlier offsets remain valid. Atomic rollback on any failure.
|
|
1691
|
+
- **Ice Wall whitelist scope corrected** — applied per-CodeAction (on `title`) rather than per-TextEdit.
|
|
1692
|
+
|
|
1693
|
+
### Typing
|
|
1694
|
+
- Canonical LSP shapes (`LspPosition`, `LspRange`, `LspDiagnostic`, `LspTextEdit`, `LspCodeAction`) moved to `src/kernel/types.ts`.
|
|
1695
|
+
- Local `LspProtocol*` interfaces added in `lsp-sidecar-base.ts` for the JSON-RPC wire contract. The one `as LspProtocolCodeAction[] | null` cast is the single documented assertion on the LSP protocol — no scattered `as any` anywhere in the new code.
|
|
1696
|
+
- `as any` cast on `requestCodeActions` in `nreki-kernel.ts` removed; types flow end-to-end.
|
|
1697
|
+
|
|
1698
|
+
### Tests
|
|
1699
|
+
- 765/765 pass (51 files): prior 760 + 5 new in `tests/healer-atomic.test.ts` covering multi-edit CodeAction atomic apply, full rollback on validation failure, descending-offset same-file ordering, multi-file CodeAction, and destructive-action whitelist rejection.
|
|
1700
|
+
- `tests/lsp-sidecar.test.ts` assertion migrated from `fixes[0].newText` to `fixes[0].edits[0].newText` for the new shape.
|
|
1701
|
+
|
|
1702
|
+
### Not in scope
|
|
1703
|
+
- Wave 3 (Patch 6, shadow-generator escape-loop + harvester drain) still targeted for v10.6.
|
|
1704
|
+
|
|
1705
|
+
## 10.5.8 (2026-04-16) — Round-5 Audit Retrofits + Tolerant Patch
|
|
1706
|
+
|
|
1707
|
+
Follow-up to v10.5.7 that closes two gaps found during type review and adds the Tolerant Patch ergonomics improvement. Shipped as three bisectable commits.
|
|
1708
|
+
|
|
1709
|
+
### Correctness
|
|
1710
|
+
- **`validateSingleBatchEdit` typed via `Partial<BatchEditOp>` (retrofit).** The helper introduced in v10.5.7 Patch 1 took `edit: any`. Replaced with the canonical `BatchEditOp` shape from `semantic-edit.ts` (under `Partial<>` to model pre-validation input that may be missing fields). Zero behavior change; removes an `any` footgun.
|
|
1711
|
+
- **`normalizeEditModes` in `router.ts` (Patch 2).** Agents that send a well-formed `{search_text, replace_text}` payload to `edit`/`batch_edit` without the `mode` field were blocked by the Cognitive Enforcer's blind-edit rule, because the enforcer only short-circuits when it sees `mode:"patch"` explicitly. `handleCode` now infers the mode from payload shape (`{search_text, replace_text}` → `"patch"`, `{new_code}` alone → `"replace"`, explicit `mode` preserved) before the enforcer evaluates. In-place mutation; downstream handlers are idempotent to the re-check.
|
|
1712
|
+
|
|
1713
|
+
### Ergonomics
|
|
1714
|
+
- **Tolerant Patch: fuzzy indentation matching in Phantom Scalpel (Patch 3 extension).** When exact-match patch mode yields 0 occurrences, `applySemanticSplice` now retries with an indent-flexible regex (each line trim-start, `[ \t]*` prefix). On exactly one fuzzy match, the replacement is rebased onto the original's indentation and the patch proceeds. On 2+ fuzzy matches, throws "ambiguous" with the count. The literal-`$` guarantee from v10.5.7 Patch 2 is preserved end-to-end (the escape routine uses the callback form `m => "\\" + m` instead of the `$&` backreference).
|
|
1715
|
+
|
|
1716
|
+
### Tests
|
|
1717
|
+
- 760/760 pass (50 files): 730 baseline + 19 from v10.5.7 + 11 new (5 router normalize, 6 phantom-scalpel tolerant).
|
|
1718
|
+
|
|
1719
|
+
### Not in scope
|
|
1720
|
+
- Wave 2 (Patch 5, LSP auto-healer atomic multi-TextEdit) targeted for v10.5.9.
|
|
1721
|
+
- Wave 3 (Patch 6, shadow-generator escape-loop + harvester drain) targeted for v10.6.
|
|
1722
|
+
|
|
1723
|
+
## 10.5.7 (2026-04-16) — Round-5 Audit Hot-Patches (Wave 1)
|
|
1724
|
+
|
|
1725
|
+
Three localized security/correctness fixes shipped as separate bisectable commits before the 2026-05-21 Show HN launch.
|
|
1726
|
+
|
|
1727
|
+
### Security (Critical)
|
|
1728
|
+
- **Cognitive Enforcer batch_edit bypass closed (Patch 1).** Pre-fix, `evaluate()` only validated `batch_edit` payloads when `params.edits.length === 1`. Any batch of 2+ edits fell through to an unconditional `{ blocked: false }`, allowing a "disguise batch" attack (1 real blind edit + 1 dummy comment edit) to smuggle blind edits past the cognitive firewall. The enforcer now iterates every edit in the batch and validates each independently via a new `validateSingleBatchEdit` helper. Any single blind edit blocks the whole batch. This was a real enforcement gap — acknowledged plainly rather than spun.
|
|
1729
|
+
|
|
1730
|
+
### Correctness
|
|
1731
|
+
- **Phantom Scalpel patch mode literal replacement (Patch 2).** `applySemanticSplice` patch mode used `String.prototype.replace(string, string)`, which still interprets V8 substitution tokens (`$&`, `$'`, `` $` ``, `$$`) in the replacement string. An LLM patching a shell template with `$'quoted'` or a regex literal with `$&` saw silent substitution. Switched to `split(search).join(replace)` — always literal, and semantically identical under the existing `occurrences === 1` guard.
|
|
1732
|
+
|
|
1733
|
+
### Reliability
|
|
1734
|
+
- **`saveBackup` OOM guard (Patch 3).** Pre-fix, `saveBackup` called `fs.readFileSync(path, "utf-8")` before checking for binary content. A 2GB misdirected file (log, dump, db accidentally passed by the agent) was loaded into the V8 heap as a UTF-8 string before the null-byte check fired, crashing the MCP server with `Allocation failed - JavaScript heap out of memory`. The function now opens an FD, rejects files > 100MB (no code file is ever this big), probes the first 8KB for null bytes via `Uint8Array`, and only then calls `readFileSync`.
|
|
1735
|
+
|
|
1736
|
+
### Tests
|
|
1737
|
+
- 749/749 pass (48 files): 730 baseline + 7 new (cognitive-enforcer) + 6 new (phantom-scalpel patch-2) + 6 new (undo OOM).
|
|
1738
|
+
|
|
1739
|
+
### Internal
|
|
1740
|
+
- Baseline test infrastructure note: vitest 4.1.1 parallel mode (`pool: "forks"` + `fileParallelism: true`) emits "Vitest failed to find the runner" on all 45 test files. Workaround: `npx vitest run --no-file-parallelism` (serial, ~5 min). Root cause out of scope for this release; tracked separately.
|
|
1741
|
+
|
|
1742
|
+
## 10.5.1 (2026-04-15) — Dynamic Risk Expansion
|
|
1743
|
+
|
|
1744
|
+
### Changed
|
|
1745
|
+
- **`handleOutline` auto-expand es ahora dinámico (knapsack):** en lugar de los 3 símbolos HIGH-risk más grandes fijos, expande todos los que quepan en un presupuesto de 6,000 tokens. Nuevo umbral de tamaño por símbolo sube de 100 a 150 líneas.
|
|
1746
|
+
- **Warning `[BUDGET LIMIT REACHED]`** con lista de los primeros 8 símbolos omitidos y comando `nreki_code action:"compress" focus:"..."` listo para copiar.
|
|
1747
|
+
- **Orden de expansión** dentro del outline: una vez seleccionados por presupuesto, se re-ordenan por `startLine` ascendente para que el lector recorra el archivo linealmente.
|
|
1748
|
+
|
|
1749
|
+
### Fixed
|
|
1750
|
+
- **`computeTriageRisk` filtro anti-trivialidad:** símbolos de ≤3 líneas ahora restan 2 al score. Evita marcar getters/constantes/exports triviales como HIGH-risk.
|
|
1751
|
+
|
|
1752
|
+
### Docs
|
|
1753
|
+
- `templates/CLAUDE.md` y `skills/SKILL.md` actualizados con la nueva política de presupuesto y la instrucción crítica de usar `compress` cuando aparece `[BUDGET LIMIT REACHED]`.
|
|
1754
|
+
|
|
1755
|
+
### Tests
|
|
1756
|
+
- 729/729 pasan (45 archivos, ~142s).
|
|
1757
|
+
|
|
1758
|
+
## 10.5.0 (2026-04-15) — Pre-Launch Security Hardening
|
|
1759
|
+
|
|
1760
|
+
### Security (Critical)
|
|
1761
|
+
- **RCE blocklist expansion (path-jail):** `.claude/hooks/`, `.claude/settings*.json` (covers `settings.json` + `settings.local.json`), and `.mcp.json` are now blocked. Closes PreToolUse hook injection and rogue MCP server injection vectors.
|
|
1762
|
+
- **SQL injection fix:** `NrekiDB.getEngramsForFile` migrated from string interpolation to parameterized prepared statement.
|
|
1763
|
+
- **Prototype pollution guards:** `chronos-memory.ts`, `cognitive-enforcer.ts`, and `repo-map.ts` JSON cache loaders now reject `__proto__`/`constructor`/`prototype` keys via `JSON.parse` reviver. `ChronosMemory.normalize` rejects paths normalizing to those reserved names.
|
|
1764
|
+
- **Path traversal guard in CLI enforcer hook** generated by `getEnforcerScriptContent()`; resolved paths must stay inside `cwd`.
|
|
1765
|
+
- **Auto-patch of legacy enforcer hook on boot:** existing installations missing the traversal guard are rewritten with the hardened script before `server.connect()`.
|
|
1766
|
+
- **`set_plan` stores relative POSIX path** in `nreki_master_plan` metadata instead of absolute path.
|
|
1767
|
+
|
|
1768
|
+
### Correctness
|
|
1769
|
+
- **Guillotine de payload es ahora incondicional** en `semantic-edit.ts` (eliminados `&& !dryRun`).
|
|
1770
|
+
- **Recuperación de SQLite corrupto:** `NrekiDB._init()` envuelve la carga en try/catch y recrea la BD si el buffer está dañado.
|
|
1771
|
+
- **`isError: true`** añadido a las 4 salidas tempranas de `handlePin` / `handleUnpin`, evitando que el circuit breaker cuente fallos como éxitos.
|
|
1772
|
+
- **CRLF/LF handling en Phantom Scalpel:** `applySemanticSplice` adapta `search_text`/`replace_text` al fin de línea del archivo destino (patch mode) y normaliza `new_code` a LF antes del rebase de indentación (replace mode).
|
|
1773
|
+
- **Router facades (`handleNavigate`, `handleCode`, `handleGuard`)** llaman `await deps.engine.initialize()` al inicio; `handleGuard` ahora incluye karma penalty en el cálculo de presión, alineándose con los otros dos facades.
|
|
1774
|
+
|
|
1775
|
+
### Performance
|
|
1776
|
+
- **Lazy-load del raw identifier index:** `NrekiDB.searchRawCode` construye el índice en la primera llamada (`buildRawIdentsIfNeeded`) en vez de al boot.
|
|
1777
|
+
|
|
1778
|
+
### Cosmetic
|
|
1779
|
+
- **`computeTriageRisk`**: regex de ternario con lookaround `(?<!\?)\?(?!\.|:|\?)` evita inflar el conteo de ramas con `?.` (optional chaining) u `??`.
|
|
1780
|
+
|
|
1781
|
+
### Tests
|
|
1782
|
+
- 729/729 pasan (45 archivos, ~140s).
|
|
1783
|
+
|
|
1784
|
+
## 8.0.2 (2026-04-09) — Firewall Verification Test
|
|
1785
|
+
|
|
1786
|
+
### Fixed (Test Coverage Gap)
|
|
1787
|
+
- **Numerical Sanity Firewall regression test:** v8.0.1 introduced an 8-layer
|
|
1788
|
+
defense in depth against IEEE 754 NaN/Infinity propagation in the spectral
|
|
1789
|
+
solver, but the firewall itself had no dedicated regression test — none of
|
|
1790
|
+
the 712 existing tests constructed a graph that triggered real overflow in
|
|
1791
|
+
the power iteration. This release adds a single test that builds a star
|
|
1792
|
+
graph with extreme weights (1e150 × 1000 nodes), demonstrably overflows the
|
|
1793
|
+
`norm` accumulator (`val² ≈ 1e306` × 1000 = `1e309 > Number.MAX_VALUE`),
|
|
1794
|
+
and verifies that the Hot-Loop Thermal Guard catches `Infinity` in `norm`,
|
|
1795
|
+
the λ₂ short-circuit catches the resulting `NaN`, and the function falls
|
|
1796
|
+
back to the degenerate variant of the discriminated union (no `v2`,
|
|
1797
|
+
`lambda3`, or `v3`). Defense without verification was half a defense; this
|
|
1798
|
+
closes that gap.
|
|
1799
|
+
|
|
1800
|
+
### Notes
|
|
1801
|
+
- **Tests:** 712 → 713 (the new firewall regression test).
|
|
1802
|
+
- **Behavioral change:** none. This is purely a coverage addition.
|
|
1803
|
+
- **No breaking changes.** No API surface modified.
|
|
1804
|
+
- The 3 deferred items from v8.0.1 remain deferred:
|
|
1805
|
+
- **Kahan summation:** rejected (precision obliterated by `toFixed(4)`)
|
|
1806
|
+
- **PageRank FP audit:** rejected (mathematically immune via L1 simplex)
|
|
1807
|
+
- **God Object kernel refactor:** deferred to v8.1 (SRE rule: never mix
|
|
1808
|
+
architectural refactors with critical patches)
|
|
1809
|
+
|
|
1810
|
+
---
|
|
1811
|
+
|
|
1812
|
+
## 8.0.1 (2026-04-08) — IEEE 754 Hardening: NaN Sink Eradication
|
|
1813
|
+
|
|
1814
|
+
### Fixed (Critical — Mathematical Soundness)
|
|
1815
|
+
- **Spectral Bridge Threshold:** Latent NaN sink in `repo-map.ts` `gamma` calculation. Power iteration on hub-heavy graphs could overflow (`c·v − L·v → Inf − Inf → NaN`), and IEEE 754 makes both `NaN > 1e-9` and `NaN <= 1e-9` evaluate to `false`. The previous fallback silently substituted `γ = 1.0` (a fictitious `λ₃ = λ₂`), producing **phantom architectural bridges** with zero spectral guarantee. Fixed via 8-layer defense in depth.
|
|
1816
|
+
- **`SpectralMath.analyzeTopology` return type:** Replaced "bag of optionals" (`v2?`, `lambda3?`, `v3?`) with a strict **discriminated union** that encodes the runtime invariant `v2 ⟺ lambda3 ⟺ v3`. Consumers narrowing on `if (result.v2)` now get `lambda3: number` and `v3: Float64Array` for free — no more paranoid `lambda3 !== undefined` checks downstream, and the type system actively prevents the original ternary from being written again.
|
|
1817
|
+
- **Numerical Sanity Firewall (Producer):** Added an `O(N)` perimeter check before the final return of `analyzeTopology`. If `res2.val`, `res3.val`, or any element of `res2.vec` / `res3.vec` is non-finite, the function falls back to the degenerate variant `{ fiedler: 0, volume }`. Restores the invariant "spectral vectors are finite, or they don't exist at all".
|
|
1818
|
+
- **HPC Hot-Loop Thermal Guard:** Added explicit `return { val: NaN, vec }` inside the SpMV power iteration. If `mu` or `norm` corrupt to NaN/Infinity mid-iteration, the loop aborts immediately, **skipping the gauge fixing pass over a poisoned `vec` array**. Saves up to 150 wasted iterations of NaN propagation and hands off cleanly to the perimeter firewall.
|
|
1819
|
+
- **λ₃ Short-Circuit:** If `λ₂` extraction yields NaN, skip the second power iteration entirely (would otherwise receive a poisoned `res2.vec` as deflation basis and contaminate from `iter=0`). Saves one full SpMV cycle on degenerate inputs.
|
|
1820
|
+
- **Denormal Float Guard:** Replaced `if (degree[i] > 0)` with `if (degree[i] > 1e-12)` in the normalized Laplacian path. Subnormal floats (~2.2e-308 and below) force the CPU FPU into microcode emulation causing **~100x pipeline stalls**, and `1.0 / Math.sqrt(1e-320) ≈ 1e+160` overflows in subsequent SpMV products. Threshold safely above the denormal range.
|
|
1821
|
+
- **Consumer NaN Trap:** Simplified the `gamma` ternary in `repo-map.ts` now that `lambda3` narrows to `number`. Explicit `Number.isNaN(spectral.fiedler)` check, fail-closed: NaN or near-zero `fiedler → γ=∞ → bridgeThreshold=0`. Second line of defense after the producer firewall.
|
|
1822
|
+
- **Timsort Determinism Guard:** V8's `Array.prototype.sort()` (TimSort) silently breaks transitivity if the comparator returns NaN, producing implementation-defined order that **would silently poison prompt cache byte-identity across runs**. The Bridge stress ranking comparator in `repoMapToText` now returns `0` (tie) on NaN to keep sort stable and reproducible.
|
|
1823
|
+
|
|
1824
|
+
### Notes
|
|
1825
|
+
- **Bridge threshold bounds:** v8.0.0 CHANGELOG documented the bounds as `[0.01, 0.15]`. The implementation enforces these exact bounds — no change in v8.0.1. The fix only affects the `γ` denominator under pathological inputs.
|
|
1826
|
+
- **Kahan summation evaluated and rejected:** A rigorous HPC review considered Kahan-compensated summation for the SpMV accumulators (`norm`, `mu`) to mitigate catastrophic cancellation at large `N`. Explicitly discarded because it perturbs the last bits of the eigenvalue mantissa, which **would break byte-for-byte prompt cache consistency** (the project's "byte-identical sort" commitment, see commits `fc9c79d` and `824011f`). Trade-off: precision is bounded by naïve FP accumulation, but reproducibility is absolute. Documented decision, not technical debt.
|
|
1827
|
+
- **712 tests pass unchanged.** No behavioral regression on the happy path. The fixes only activate under conditions the existing test suite does not synthesize (overflow on `maxDegree*2+1` shift, denormal weights). Future work: a hub-overflow regression test for v8.1.
|
|
1828
|
+
|
|
1829
|
+
### Internal
|
|
1830
|
+
- `tests/spectral-topology.test.ts:101-113` formally validates the `v2 ⟺ lambda3 ⟺ v3` invariant via `expect(result.lambda3).toBeDefined()` for non-trivial graphs. The discriminated union now enforces this at compile time.
|
|
1831
|
+
|
|
1832
|
+
---
|
|
1833
|
+
|
|
1834
|
+
## 8.0.0 (2026-04-02) — Antigravity: Spectral Architecture Engine
|
|
1835
|
+
|
|
1836
|
+
### Breaking Changes
|
|
1837
|
+
- **Cache format:** `CACHE_FORMAT_VERSION` bumped from 1 to 2. Old `.nreki/repo-map.json` caches are auto-regenerated on first run. No manual action needed.
|
|
1838
|
+
- **`buildDependencyGraph`** is now `async` (returns `Promise<DependencyGraph>`). Only affects code that imports this function directly.
|
|
1839
|
+
- **`interceptAtomicBatch`** signature extended with optional `computeDiff: boolean = false` parameter. Backward compatible (defaults to `false`).
|
|
1840
|
+
|
|
1841
|
+
### Features — Spectral Clustering & Architecture Intelligence
|
|
1842
|
+
- **Cyclomatic Complexity (β₁):** True topological circuit rank via Union-Find with path compression on the type constraint graph. Excludes `EXTERNAL::` nodes. Formula: `β₁ = E_int - V_int + C_int` (first Betti number). Added to `SpectralResult.cyclomaticComplexity`.
|
|
1843
|
+
- **Architecture Diff:** Real-time λ₂ and β₁ shift detection on `batch_edit`. Shows algebraic connectivity change, circuit rank delta, and verdict (`APPROVED` / `APPROVED_DECOUPLING` / `REJECTED_ENTROPY`). Opt-in via `computeDiff: true` on `interceptAtomicBatch`, auto-enabled for `batch_edit`.
|
|
1844
|
+
- **Spectral Clustering:** File-level macro-topology using the Fiedler vector (v₂) from the combinatorial Laplacian. Partitions the repository into `cluster_a` (positive polarity), `cluster_b` (negative polarity), `bridge` (v₂ ≈ 0, structural bottleneck), and `orphan` (zero degree). Bridge threshold: `ε = σ/γ` where `γ = λ₃/λ₂` (spectral gap ratio), bounded `[0.01, 0.15]`.
|
|
1845
|
+
- **Repo Map v2:** `repoMapToText` now renders files grouped by spectral cluster with topology metadata. Bridges sorted by stress ranking (`inDegree / |v₂|`). Header includes λ₂ value. Fallback rendering for pre-v8 caches.
|
|
1846
|
+
- **Orphan Oracle:** `nreki_navigate action:"orphan_oracle"` — Mark-and-Sweep reachability analysis from framework roots (index, main, config, tests, routes, stories, migrations, service workers). Reports files with exports that are completely unreachable via static imports. Includes dynamic import warning.
|
|
1847
|
+
- **Bridge Guard:** `handleEdit` now detects when the target file is a structural bridge (v₂ ≈ 0) and injects a real-time warning to the LLM with v₂ score, dependent count, and instructions to use `batch_edit` for signature changes.
|
|
1848
|
+
- **DependencyGraph extended:** New optional fields `clusters`, `v2Score`, `fiedler` on `DependencyGraph` and `DependencyGraphData`. Fully serializable for cache persistence.
|
|
1849
|
+
- **NrekiInterceptResult extended:** New optional field `architectureDiff` carries the formatted topology diff string.
|
|
1850
|
+
|
|
1851
|
+
### Internal
|
|
1852
|
+
- `SpectralResult` interface extended with optional `cyclomaticComplexity` field.
|
|
1853
|
+
- `serializeGraph` / `deserializeGraph` updated for cluster data round-tripping.
|
|
1854
|
+
- `processKernelResult` concatenates `architectureDiff` to TTRD feedback.
|
|
1855
|
+
- Router dispatch extended with `orphan_oracle` case.
|
|
1856
|
+
- Zod schema for `nreki_navigate` extended with `orphan_oracle` action.
|
|
1857
|
+
- Test assertions updated for new repo map header format (`λ₂=` suffix).
|
|
1858
|
+
- All 712 tests pass.
|
|
1859
|
+
|
|
1860
|
+
---
|
|
1861
|
+
|
|
1862
|
+
## 7.4.1 (2026-03-31) — Normalized Laplacian + Isolated Node Exile
|
|
1863
|
+
|
|
1864
|
+
### Features
|
|
1865
|
+
- **Spectral Topology:** `normalized: boolean = false` flag on `analyzeTopology()`. When true, uses symmetric normalized Laplacian (L_sym = I - D^{-1/2}AD^{-1/2}) confining λ₂ to [0, 2] instead of [0, ∞). Covers 4 critical traps: deflation against √D, div/0 guard for isolated nodes, shift constant c=2.0, and diagonal=1.0 for connected nodes.
|
|
1866
|
+
|
|
1867
|
+
### Fixed
|
|
1868
|
+
- **Spectral Topology:** Isolated node exile in normalized path. Degree-0 nodes had eigenvalue c in the shifted matrix (cI - L_sym), dominating over the Fiedler. Power iteration converged to orphan files instead of real architectural bottlenecks. Fix: force `v_next[i] = 0` for isolated nodes.
|
|
1869
|
+
- **npx Windows:** CJS bin wrapper (`bin/nreki.cjs`) bridges CJS→ESM so `.cmd` shim resolves correctly on all platforms. `npx @ruso-0/nreki` now works on Windows.
|
|
1870
|
+
|
|
1871
|
+
---
|
|
1872
|
+
|
|
1873
|
+
## 7.3.5 (2026-03-31) — Full Security Audit
|
|
1874
|
+
|
|
1875
|
+
### Security
|
|
1876
|
+
- **Path Jail:** Symlink bypass on sensitive file check — now validates realpath target
|
|
1877
|
+
- **Path Jail:** TTRD pre-scan reads files before path jail validation (arbitrary file read)
|
|
1878
|
+
- **Path Jail:** LSP codeAction `bestFix.filePath` not validated against workspace
|
|
1879
|
+
- **Path Jail:** `compressFile`/`compressFileAdvanced` now enforce path jail
|
|
1880
|
+
- **Path Jail:** Context Heartbeat master plan path validated via safePath (LFI fix)
|
|
1881
|
+
- **LSP Sidecar:** `Date.now()` overflows int32 in gopls — replaced with monotonic counter
|
|
1882
|
+
- **LSP Sidecar:** Windows URI case mismatch breaks auto-healing on Windows
|
|
1883
|
+
- **Auto-Healer:** `SAFE_FIXES` removed `fixClassDoesntImplementInheritedAbstractMember` and `fixAddMissingMember` — both inject `throw new Error("Method not implemented.")` stubs
|
|
1884
|
+
|
|
1885
|
+
### Critical Fixes
|
|
1886
|
+
- **Kernel:** `mutatedFiles` not cleared in `commitToDisk()` catch + `rollbackAll()` — next commit deletes real user files
|
|
1887
|
+
- **Kernel:** Auto-healed files never registered in `mutatedFiles` — healed code vanishes from disk
|
|
1888
|
+
- **Database:** `save()` atomic via temp+rename (prevents truncation on crash)
|
|
1889
|
+
- **Database:** `updateAvgDocLen()` O(N²) → O(1) via running total (prevents DoS on bulk indexing)
|
|
1890
|
+
|
|
1891
|
+
### Fixed
|
|
1892
|
+
- **Kernel:** WAL recovery per-entry try-catch — one locked file no longer destroys all backups
|
|
1893
|
+
- **Kernel:** VFS ghosting in hologram — pruned files with VFS edits now visible to compiler
|
|
1894
|
+
- **Kernel:** `fs.readFileSync` unprotected in healer hot path — ENOENT no longer aborts transaction
|
|
1895
|
+
- **Kernel:** Corruption guard moved inside mutex (prevents concurrent `purgeCache()`)
|
|
1896
|
+
- **Kernel:** `createdTmps.push` before write (prevents orphaned .tmp on ENOSPC)
|
|
1897
|
+
- **Kernel:** `rollbackSidecars` docstring updated to reflect async behavior
|
|
1898
|
+
- **LSP Sidecar:** `didClose` tombstone replaced with empty `didChange` (prevents split-brain)
|
|
1899
|
+
- **LSP Sidecar:** Buffer overflow triggers `forceKill()` instead of silent truncation
|
|
1900
|
+
- **TS Compiler:** `getAutoFixes` matches by line+column (prevents infinite micro-rollback loop)
|
|
1901
|
+
- **TS Compiler:** Pre-compiled regex in `getFingerprint` (3 RegExp per diagnostic → 0)
|
|
1902
|
+
- **TS Compiler:** Cascade threshold includes sample of first 5 errors for LLM diagnosis
|
|
1903
|
+
- **Spectral:** Removed ObjectLiteral/ArrayLiteral/CallExpression pruning (Vue/Express/tRPC visibility)
|
|
1904
|
+
- **Spectral:** `isMethodDeclaration` + `isFunctionDeclaration` added to signature interceptor
|
|
1905
|
+
- **Database:** `insertChunksBatch` rollback purges phantom entries from RAM indexes
|
|
1906
|
+
- **Engine:** Thundering herd on `unlink` — `db.save()` replaced with 1s debounced `scheduleSave()`
|
|
1907
|
+
- **Engine:** Ghost chunks cleaned on early return (filtered/empty files)
|
|
1908
|
+
- **Engine:** T-RAG `cachedGraph` invalidated after watcher changes
|
|
1909
|
+
- **Semantic Edit:** Batch edit ambiguity check — rejects duplicate symbol names
|
|
1910
|
+
- **Semantic Edit:** Single edit atomic write via temp+rename
|
|
1911
|
+
- **Router:** Heartbeat `<=` → `<` prevents infinite injection loop on tool failure
|
|
1912
|
+
|
|
1913
|
+
## 7.3.1 (2026-03-30)
|
|
1914
|
+
|
|
1915
|
+
### Security
|
|
1916
|
+
- **Path Jail:** Block `.git/hooks/` (RCE vector), `.envrc` (direnv RCE), `.age/` directories
|
|
1917
|
+
- **Path Jail:** Fail-closed on parent resolution errors (was fail-open on EACCES/ELOOP)
|
|
1918
|
+
- **LSP Sidecars:** ENV whitelist — secrets no longer leak to gopls/pyright child processes
|
|
1919
|
+
|
|
1920
|
+
### Fixed
|
|
1921
|
+
- **TTRD Python:** `^\s*def` captures indented class methods (was `^def` — missed all methods inside classes)
|
|
1922
|
+
- **TTRD Python:** Triple-quoted docstrings no longer corrupt bracket balancer
|
|
1923
|
+
- **TTRD Go:** Private functions now tracked (was exported-only)
|
|
1924
|
+
- **Auto-Healer:** Global error comparison replaces per-file (prevents collateral damage approval)
|
|
1925
|
+
- **Auto-Healer:** Micro/macro rollbacks are synchronous (cures LSP split-brain)
|
|
1926
|
+
- **Pull Diagnostics:** Cross-file error collection from all open files
|
|
1927
|
+
- **Pull Diagnostics:** Push notifications suppressed in pull mode (race condition fix)
|
|
1928
|
+
- **WAL:** Atomic write via temp+rename (prevents truncation on crash)
|
|
1929
|
+
- **Hologram:** `currentEditTargets` cleared on rollback (prevents ghost unpruning)
|
|
1930
|
+
- **Process Kill:** `kill(-pid)` on POSIX kills entire process group (prevents zombie workers)
|
|
1931
|
+
- **VectorIndex:** Always deep-copy on deserialize (prevents buffer sharing with WASM)
|
|
1932
|
+
|
|
1933
|
+
## v7.3.0 - Multi-Language Auto-Healing (2026-03-29)
|
|
1934
|
+
|
|
1935
|
+
### Added — Multi-Language (9 Surgeries)
|
|
1936
|
+
- **LSP Auto-Healing Dual Cascade** (`nreki-kernel.ts`): Go (gopls) and Python (pyright) errors auto-fixed via `textDocument/codeAction`. Conservative whitelist: only import-related fixes. Ice Wall filter blocks "remove"/"delete" actions. TypeScript heals first (~20ms), then LSP (~300ms, max 2 iterations). Split-brain rollback re-syncs sidecar VFS on micro-rollback
|
|
1937
|
+
- **TTRD Syntactic v2** (`nreki-kernel.ts`): Hybrid micro-scanner (regex anchor + bracket balancer) extracts signatures from Python/Go. Detects toxic `Any`/`interface{}` injection, lost return types (`->`), and stripped parameter annotations. Zero false positives on clean refactors (e.g. `Dict[str, Union[...]]` → `ConfigPayload`)
|
|
1938
|
+
- **Pull Diagnostics LSP 3.17+** (`lsp-sidecar-base.ts`): `textDocument/diagnostic` replaces 150ms settle timer. Deterministic — NREKI waits for server response, not a timer. Falls back to push model for older LSP servers
|
|
1939
|
+
- **Python import resolution** (`repo-map.ts`): Dot-notation (`app.core.auth`) converted to slashes (`app/core/auth`) with progressive strip fallback. Real edges in dependency graph
|
|
1940
|
+
- **Go import resolution** (`repo-map.ts`): Suffix matching for `github.com/org/project/utils` → local `utils/`. Real edges in dependency graph
|
|
1941
|
+
- **`requestCodeActions()` + title** (`lsp-sidecar-base.ts`): LSP `textDocument/codeAction` exposed with action title for whitelist filtering. Supports both `WorkspaceEdit.changes` and `documentChanges` formats
|
|
1942
|
+
- **LSP coordinate translator** (`nreki-kernel.ts`): `getLspOffset()` converts LSP line/character (0-indexed) to byte offsets. Survives `\r\n` (Windows)
|
|
1943
|
+
- **Mock LSP Server** (`tests/mock-lsp-server.ts`): Full JSON-RPC 2.0 test server. 8 scenarios: `missing_import`, `clean`, `unfixable`, `destructive`, `multi_error`, `slow_response`. Responds to `initialize`, `textDocument/didOpen`, `textDocument/diagnostic`, `textDocument/codeAction`
|
|
1944
|
+
- **TypeScript Corsa Backend placeholder** (`ts-corsa-sidecar.ts`): Ready for Microsoft Project Corsa (TypeScript 7.0 in Go). Inherits `LspSidecarBase`. Strangler Fig hot-swap when Corsa ships
|
|
1945
|
+
|
|
1946
|
+
### Added — Lifecycle Hardening
|
|
1947
|
+
- **SSOT `cleanupState()`** (`lsp-sidecar-base.ts`): Single idempotent embudo for all process death paths. `if (this.isDead) return` guard prevents double-cleanup when `forceKill()` and `exit` event collide
|
|
1948
|
+
- **Explicit timer tracking** (`lsp-sidecar-base.ts`): `PendingRequest` now stores `timer: NodeJS.Timeout`. `cleanupState()` kills all timers directly — no closure indirection
|
|
1949
|
+
- **`forceKill()` with stdin destroy** (`lsp-sidecar-base.ts`): Destroys stdin pipe before SIGKILL, forcing OS to propagate closure to entire process tree (kills tsx wrappers and grandchildren)
|
|
1950
|
+
- **`spawnEnv` injection** (`lsp-sidecar-base.ts`): Optional 4th constructor parameter for isolated env vars. Tests no longer mutate `process.env` globally
|
|
1951
|
+
|
|
1952
|
+
### Added — Miner
|
|
1953
|
+
- **Chronos Miner v10 Turbine Oracle** (`chronos-miner.ts`): `git cat-file --batch` streaming (single process per chunk). Dynamic `import()` extraction. Pure TS/JS scope (`.mjs`, `.cjs` included). `node_modules/` and `dist/` filtered by regex segment. 512MB maxBuffer
|
|
1954
|
+
|
|
1955
|
+
### Changed
|
|
1956
|
+
- Tests: 704 → 712 (44 suites). +8 LSP sidecar tests, +1 kernel CRLF test
|
|
1957
|
+
- `LspSidecarBase`: `request()`, `toPosix()`, `workspaceUri`, `realProjectRoot` changed from `private` to `protected`
|
|
1958
|
+
- `LspPosition` and `LspRange` interfaces exported for kernel consumption
|
|
1959
|
+
- `shutdown()` now delegates entirely to `forceKill()` → `cleanupState()`
|
|
1960
|
+
- Boot error handler, exit handler, and initialize catch all route through `cleanupState()` — zero asymmetric cleanup
|
|
1961
|
+
- Healing message now groups TypeScript fixes and LSP fixes separately in output
|
|
1962
|
+
- `interceptAtomicBatch()` uses Dual Cascade: TS healing first, then LSP healing only if TS succeeded
|
|
1963
|
+
|
|
1964
|
+
## v7.1.2 - 9 Critical Patches
|
|
1965
|
+
|
|
1966
|
+
### Fixed
|
|
1967
|
+
- **Ghost Deletion** (`nreki-kernel.ts`): `mutatedFiles` now cleaned on rollback — prevents `commitToDisk()` from deleting real files that belonged to failed transactions
|
|
1968
|
+
- **searchRawCode exact match** (`database.ts`): Replaced `String.includes()` with `Set.has()` — eliminates false positives (e.g. "id" no longer matches "width") and changes complexity from O(N) to O(1)
|
|
1969
|
+
- **Arrow function angleDepth** (`parser.ts`): `=>` operator no longer decrements `angleDepth` below 0 — prevents extracting entire arrow function bodies as "signatures" in the repo map
|
|
1970
|
+
- **Circuit Breaker exception visibility** (`circuit-breaker.ts`): `wrapWithCircuitBreaker` now catches handler exceptions via try/catch and converts them to `McpToolResponse` with `isError: true` — breaker is no longer blind to ENOENT loops and timeout cascades
|
|
1971
|
+
- **Prompt cache preservation** (`router.ts`): Context Heartbeat now injected AFTER original text for all actions (not just `map`) — preserves Anthropic prefix cache hit rate
|
|
1972
|
+
- **clearChunks files table** (`database.ts`): `clearChunks()` now also deletes from `files` table — prevents permanent invisibility when a file is deleted and recreated with the same content
|
|
1973
|
+
- **splitParams string-aware** (`shadow-generator.ts`): `splitParams()` now tracks string state (single, double, backtick quotes) — prevents splitting on commas inside string literals that produce broken `.d.ts` output
|
|
1974
|
+
- **LSP sidecar listener cleanup** (`lsp-sidecar-base.ts`): `proc.on("error")` handler now removes exit/SIGINT/SIGTERM listeners — prevents `MaxListenersExceededWarning` and memory leak on repeated spawn failures
|
|
1975
|
+
- **macOS case-insensitive file lock** (`file-lock.ts`): `normalizeLockKey` now treats `darwin` same as `win32` (lowercase) — prevents file corruption from parallel locks on `App.ts` vs `app.ts` on macOS APFS
|
|
1976
|
+
|
|
1977
|
+
### Changed
|
|
1978
|
+
- Tests: 696 → 704 (8 new tests for patch coverage)
|
|
1979
|
+
- CI: replaced hardcoded `grep "696 passed"` with JSON reporter validation (no more brittle test count checks)
|
|
1980
|
+
|
|
1981
|
+
## v7.0.0 - Software Physics Engine
|
|
1982
|
+
|
|
1983
|
+
### Added
|
|
1984
|
+
- **Fiedler Vector extraction**: `analyzeTopology` now returns the full eigenvector `v2` (bridge fragility map)
|
|
1985
|
+
- **Third eigenvalue (λ₃)**: Enables spectral gap computation ∇(λ₃ - λ₂) for spectral gap analysis
|
|
1986
|
+
- **Third eigenvector (v3)**: Topological stress coordinates per node
|
|
1987
|
+
- **Gauge Fixing**: Deterministic phase canonicalization prevents sign ambiguity across commits (critical for ML pipelines)
|
|
1988
|
+
- **Gram-Schmidt deflation**: Reusable `powerIteration()` function extracts arbitrary eigenvectors
|
|
1989
|
+
- **nodeIndex passthrough**: `SpectralTopologist.analyze()` now returns the symbol→index mapping
|
|
1990
|
+
- **Monorepo workspace resolution**: `buildFastLookup` resolves `@org/package` imports via O(1) string math (supports packages/, workspaces/, libs/, apps/)
|
|
1991
|
+
- **Adaptive Shotgun Surgery threshold**: Scales with repo size via `Math.max(8, floor(N × 0.015))` — no more false positives on large codebases
|
|
1992
|
+
- **Modern module extensions**: Full `.mts`, `.cts`, `.mjs`, `.cjs` support across parser, kernel, repo-map, and JIT holography
|
|
1993
|
+
|
|
1994
|
+
### Fixed
|
|
1995
|
+
- **VFS zombie state**: `commitToDisk()` now purges VFS on disk write failure, preventing ghost content desync
|
|
1996
|
+
- **WASM race conditions**: Serialized language loading via `loadGate` in parser.ts, ast-sandbox.ts, parser-pool.ts
|
|
1997
|
+
- **Power iteration seed**: Uses data-dependent post-mutation seed for deterministic convergence
|
|
1998
|
+
- **extractName regex purge**: Replaced 20 fragile regex patterns across 2 files with AST-first keyword-stripping word splitter
|
|
1999
|
+
- **32 audit fixes (v6.1.x)**: Shadow codegen, TTRD amnesty bypass, orphan .tmp leak, Python indentation, splice duplicate detection, WeakMap middleware, syncTechDebt phantom accumulation, undo key normalization, APFS locks, allocUnsafe, SharedArrayBuffer isolation, OOM streaming iterator, and more
|
|
2000
|
+
|
|
2001
|
+
### Changed
|
|
2002
|
+
- License changed from MIT to Apache 2.0
|
|
2003
|
+
- Tests: 696 tests (→ 704 in v7.1.2)
|
|
2004
|
+
- Vitest upgraded from 3.0.7 to 4.1.1
|
|
2005
|
+
- `detectMode` now returns "file" mode for 50-200 file projects (correct performance scaling)
|
|
2006
|
+
- `isTypeScriptFile` respects `allowJs` config (prevents false errors in strict projects)
|
|
2007
|
+
- Circuit breaker tool detection updated for v3.0+ action names
|
|
2008
|
+
- File lock timeout extended to 5 minutes for large batch edits
|
|
2009
|
+
|
|
2010
|
+
### Internal
|
|
2011
|
+
- `SpectralResult` interface extended with optional `v2`, `lambda3`, `v3`, `nodeIndex` fields (backward compatible)
|
|
2012
|
+
- Power iteration limit raised from 100 to 150 (convergence guard unchanged at 1e-7)
|
|
2013
|
+
- Chronos Miner v2: Tree-sitter based temporal dataset extractor (zero node_modules, resumable, architectural dispersion ground truth)
|
|
2014
|
+
- Worktree isolation: each miner uses `/tmp/nreki-wt-{repo}` for parallel mining
|
|
2015
|
+
|
|
2016
|
+
## v6.1.0 - Spectral Gate + Surgical Architecture (2026-03-22)
|
|
2017
|
+
|
|
2018
|
+
### Performance
|
|
2019
|
+
- CSR sparse matrix with fused Rayleigh quotient in SpMV power iteration (L1 cache friendly)
|
|
2020
|
+
- Pre-computed sourceFile/targetFile on TopologicalEdge eliminates millions of split("::") allocations
|
|
2021
|
+
- fd-based incremental log reading in TokenMonitor (no more full-file readFileSync)
|
|
2022
|
+
- In-place ring buffer (shift) and TTL eviction (splice) in CircuitBreaker — zero array allocations per tool call
|
|
2023
|
+
- Radical AST pruning in findDependencies: 8 node types short-circuited, arrow/fn bodies skipped
|
|
2024
|
+
- Eliminated redundant extractConstraintGraph calls in benchmark — O(E) RAM filtering
|
|
2025
|
+
|
|
2026
|
+
### Spectral Gate
|
|
2027
|
+
- Density-weighted Phi = lambda2 * (2V / (N*(N-1))) for star topology detection
|
|
2028
|
+
- Conditional formula: density when N unchanged (ghost/expansion), original lambda2/N when N decreases (decoupling)
|
|
2029
|
+
- 11/11 real-world projects ALL PASS: 55/55 detection, 0/55 false positives, max 95.8ms
|
|
2030
|
+
|
|
2031
|
+
### Security
|
|
2032
|
+
- NFC Unicode normalization in safePath prevents macOS NFD bypass of .env blocklist
|
|
2033
|
+
- Removed settings.py and wp-config.php from sensitive file blocklist (false positives for Django/WordPress)
|
|
2034
|
+
- healingStats encapsulated behind private field + readonly getter
|
|
2035
|
+
- CircuitBreaker accepts projectRoot in constructor instead of dynamic process.cwd()
|
|
2036
|
+
- Middleware singletons encapsulated in CircuitBreakerMiddleware class
|
|
2037
|
+
|
|
2038
|
+
### Bug Fixes
|
|
2039
|
+
- Hologram Shield 2 now evaluates semantic diagnostics on dependents, not just edited files
|
|
2040
|
+
- TTRD: removed truncated typeStr bypass — TypeFlags toxicity is sole authority
|
|
2041
|
+
- applySemanticSplice: closest-match indexOf picks nearest occurrence to AST offset
|
|
2042
|
+
- stripCallStatements: regex lastIndex advanced to prevent overlapping matches on nested calls
|
|
2043
|
+
- Surgical JIT cache invalidation in rollbackAll — only edit targets cleared, not entire cache
|
|
2044
|
+
- DocumentRegistry + LanguageService recreated on corruption to prevent OOM
|
|
2045
|
+
- Safe slice in applySemanticSplice caps indent stripping at actual whitespace
|
|
2046
|
+
- jitClassifyFile size guard (150KB) prevents event loop blocking on auto-generated files
|
|
2047
|
+
- perFileFailures GC synced with history TTL eviction
|
|
2048
|
+
- Centralized backup files in .nreki/transactions/ directory
|
|
2049
|
+
- Windows fingerprint POSIX normalization in getFingerprint
|
|
2050
|
+
- BOM-safe readSource in jitClassifyFile
|
|
2051
|
+
|
|
2052
|
+
### Code Quality
|
|
2053
|
+
- PorterStemmer extracted to src/utils/porter-stemmer.ts
|
|
2054
|
+
- Deduplicated escapeRegex in database.ts (uses escapeRegExp from utils/imports)
|
|
2055
|
+
- detectMode filters .d.mts/.d.cts files
|
|
2056
|
+
- detectLanguage supports .mts/.cts/.mjs/.cjs extensions
|
|
2057
|
+
- Deprecation warnings on TokenGuardEngine and TokenGuardDB aliases
|
|
2058
|
+
- CLAUDE.md externalized to templates/CLAUDE.md
|
|
2059
|
+
- noUnusedLocals and noUnusedParameters enabled — 14 dead code items removed
|
|
2060
|
+
- Test parallelism enabled (fileParallelism: true)
|
|
2061
|
+
- CI: npm audit, npm run lint, continue-on-error for Node 24
|
|
2062
|
+
- inferSimpleType returns "unknown" instead of "any" in shadow generation
|
|
2063
|
+
- Cache format versioning (CACHE_FORMAT_VERSION) in repo-map
|
|
2064
|
+
- mtimeMs included in computeFileDigest for stale cache detection
|
|
2065
|
+
- isEnvironmentFile uses exact basename matching instead of substring
|
|
2066
|
+
|
|
2067
|
+
### Benchmarks (11 projects, 55 test cases)
|
|
2068
|
+
|
|
2069
|
+
| Project | Files | Nodes | Edges | Max Latency | FN | FP | Result |
|
|
2070
|
+
|---------|-------|-------|-------|-------------|----|----|--------|
|
|
2071
|
+
| NREKI | 38 | 195 | 373 | 44.0ms | 0/5 | 0/5 | ALL PASS |
|
|
2072
|
+
| Zod | 195 | 2,251 | 6,242 | 32.2ms | 0/5 | 0/5 | ALL PASS |
|
|
2073
|
+
| tRPC | 89 | 828 | 1,790 | 41.3ms | 0/5 | 0/5 | ALL PASS |
|
|
2074
|
+
| Prisma | 1,970 | 3,546 | 5,319 | 7.7ms | 0/5 | 0/5 | ALL PASS |
|
|
2075
|
+
| ts-pattern | 18 | 360 | 1,425 | 10.0ms | 0/5 | 0/5 | ALL PASS |
|
|
2076
|
+
| Next.js | 1,445 | 5,024 | 7,589 | 27.0ms | 0/5 | 0/5 | ALL PASS |
|
|
2077
|
+
| Hono | 186 | 1,414 | 10,188 | 35.7ms | 0/5 | 0/5 | ALL PASS |
|
|
2078
|
+
| Drizzle ORM | 447 | 3,521 | 17,021 | 70.3ms | 0/5 | 0/5 | ALL PASS |
|
|
2079
|
+
| date-fns | 1,238 | 1,905 | 3,129 | 15.2ms | 0/5 | 0/5 | ALL PASS |
|
|
2080
|
+
| VS Code | 4,697 | 24,204 | 111,994 | 29.1ms | 0/5 | 0/5 | ALL PASS |
|
|
2081
|
+
| Effect | 362 | 10,935 | 72,723 | 95.8ms | 0/5 | 0/5 | ALL PASS |
|
|
2082
|
+
|
|
2083
|
+
## [6.0.1] - 2026-03-21
|
|
2084
|
+
|
|
2085
|
+
### Fixed
|
|
2086
|
+
- `NrekiDB.save()` and `NrekiDB.close()` guard against double-close during graceful shutdown
|
|
2087
|
+
- `file-lock.test.ts` platform guard for case-insensitive path test (macOS/Linux CI)
|
|
2088
|
+
- CI matrix expanded to Node 20, 22, 24
|
|
2089
|
+
|
|
2090
|
+
## [6.0.0] - 2026-03-19
|
|
2091
|
+
|
|
2092
|
+
### Added
|
|
2093
|
+
- **Holographic Pruning**: New performance mode for large projects (>1000 files).
|
|
2094
|
+
Replaces full `.ts` source files with lightweight `.d.ts` shadow stubs in the
|
|
2095
|
+
TypeScript compiler's VFS, dramatically reducing boot time and memory usage.
|
|
2096
|
+
- Shadow Generator (`src/hologram/shadow-generator.ts`): Tree-sitter based file
|
|
2097
|
+
classifier and `.d.ts` generator. Classifies exports as prunable (explicit types)
|
|
2098
|
+
or unprunable (inferred types). Uses AST walking, not regex.
|
|
2099
|
+
- Shadow Cache (`src/hologram/shadow-cache.ts`): Disk persistence for shadows
|
|
2100
|
+
with mtime/hash staleness detection and version guard invalidation.
|
|
2101
|
+
- Symbiotic Harvester (`src/hologram/harvester.ts`): Extracts real `.d.ts` from
|
|
2102
|
+
the TypeScript compiler during idle time, replacing heuristic shadows with
|
|
2103
|
+
compiler-grade ones. Cooperative scheduler with epoch-aware abort.
|
|
2104
|
+
- Lazy Subgraph Loading: Kernel boots with only ambient files in rootNames.
|
|
2105
|
+
Target files are added dynamically during `interceptAtomicBatch()`.
|
|
2106
|
+
- Pre-warming: Background shadow scan starts after MCP handshake, before first edit.
|
|
2107
|
+
- Domain Separation: `predictBlastRadius` disabled in hologram mode (use Layer 1
|
|
2108
|
+
AST navigator for reference queries).
|
|
2109
|
+
- **JIT Holography**: Eliminates upfront `scanProject()`. Shadows generated
|
|
2110
|
+
on-demand when TypeScript's module resolver requests files. Cold boot
|
|
2111
|
+
drops from 22.96s to 1.94s on VSCode (5,584 files). Only 642 of 5,584
|
|
2112
|
+
files are ever classified — the rest are never touched.
|
|
2113
|
+
- `NrekiKernel.setShadows()` - receive shadow scan results before boot
|
|
2114
|
+
- `NrekiKernel.hasShadows()` - check if shadows are loaded
|
|
2115
|
+
- `NrekiKernel.setJitParser()` - inject Tree-sitter parser for on-demand use
|
|
2116
|
+
- `NrekiKernel.setJitClassifier()` - inject classification function
|
|
2117
|
+
- `NrekiKernel.hasJitHologram()` - check if JIT mode is available
|
|
2118
|
+
- `NrekiKernel.getJitCacheSize()` - report on-demand classification count
|
|
2119
|
+
- `NrekiKernel.getLogicalTime()` - monotonic clock for harvester epoch detection
|
|
2120
|
+
- `NrekiKernel.getProgram()` - access TypeScript Program for harvester .d.ts emission
|
|
2121
|
+
- `NrekiMode` type extended with `"hologram"`
|
|
2122
|
+
- `detectMode()` returns `"hologram"` for projects with >1000 source files
|
|
2123
|
+
|
|
2124
|
+
### Changed
|
|
2125
|
+
- VFS hooks in `NrekiKernel.boot()` now include hologram intercepts (BEFORE existing
|
|
2126
|
+
VFS checks) for `fileExists`, `readFile`, and `getScriptSnapshot`
|
|
2127
|
+
- `getFatalErrors()` semantic cascade evaluation now runs for both `project` and
|
|
2128
|
+
`hologram` modes
|
|
2129
|
+
- `RouterDependencies.nrekiMode` type includes `"hologram"`
|
|
2130
|
+
- Deferred boot in router handles hologram mode (scan before boot if pre-warm incomplete)
|
|
2131
|
+
|
|
2132
|
+
### Tests
|
|
2133
|
+
- 60 new tests across 7 test files:
|
|
2134
|
+
- `tests/hologram-shadow-generator.test.ts` (19 tests)
|
|
2135
|
+
- `tests/hologram-vfs.test.ts` (8 tests)
|
|
2136
|
+
- `tests/hologram-lazy-subgraph.test.ts` (5 tests)
|
|
2137
|
+
- `tests/hologram-domain-separation.test.ts` (3 tests)
|
|
2138
|
+
- `tests/hologram-harvester.test.ts` (6 tests)
|
|
2139
|
+
- `tests/hologram-integration.test.ts` (4 tests)
|
|
2140
|
+
- `tests/jit-holography.test.ts` (15 tests)
|
|
2141
|
+
|
|
2142
|
+
## [5.3.0] - 2026-03-18
|
|
2143
|
+
|
|
2144
|
+
### Added
|
|
2145
|
+
- **Temporal Type Regression Detection (TTRD)**: Detects when an AI agent weakens
|
|
2146
|
+
type contracts to bypass the TypeScript compiler.
|
|
2147
|
+
- Uses TypeChecker API to read compiler-resolved types, not AST text. Catches
|
|
2148
|
+
inferred type escape (`as any` in expressions) and alias weakening
|
|
2149
|
+
(`type X = any` where function signatures stay identical).
|
|
2150
|
+
- Pre/Post comparison within the same ACID transaction. No global baseline needed.
|
|
2151
|
+
- Barrel file guard: skips re-exported symbols, processes local declarations only.
|
|
2152
|
+
- Type string safety: default truncation (no NoTruncation flag), 500-char hard limit.
|
|
2153
|
+
- Submodular penalty: log2 scaling prevents cascading errors from blocking files.
|
|
2154
|
+
- Debt ledger: stores original strict types for future restoration guidance.
|
|
2155
|
+
- Debt payment: restoring strict types clears debt records and reduces friction.
|
|
2156
|
+
- Ghost debt cleanup: deleted symbols cancel their debt automatically.
|
|
2157
|
+
- Per-file regression tracking in batch edits (no friendly fire).
|
|
2158
|
+
- `NrekiKernel.extractCanonicalTypes()` - TypeChecker-based export type extraction
|
|
2159
|
+
- `NrekiKernel.computeTypeRegressions()` - Pre/Post contract comparison
|
|
2160
|
+
- `NrekiKernel.resolvePosixPath()` - public path normalization
|
|
2161
|
+
- `ChronosMemory.recordRegressions()` - submodular penalty with debt ledger
|
|
2162
|
+
- `ChronosMemory.assessDebtPayments()` - debt forgiveness on type restoration or deletion
|
|
2163
|
+
- `NrekiInterceptResult.regressions` - regression evidence per intercept
|
|
2164
|
+
- `NrekiInterceptResult.postContracts` - post-edit type contracts for debt assessment
|
|
2165
|
+
- `TypeRegression.filePath` - per-file attribution for batch edit accuracy
|
|
2166
|
+
|
|
2167
|
+
### Tests
|
|
2168
|
+
- 19 new tests in `tests/ttrd.test.ts`
|
|
2169
|
+
- extractCanonicalTypes, regression detection, false positive guards, barrel file guard,
|
|
2170
|
+
type string limits, submodular penalty, debt ledger persistence, debt payment,
|
|
2171
|
+
ghost debt, JIT warnings, happy path detection, pre/post baseline, healed path,
|
|
2172
|
+
batch edit attribution, batch debt payment, no-success-on-regression
|
|
2173
|
+
- **Performance Modes**: Auto-detection of validation depth based on project size.
|
|
2174
|
+
- `syntax` mode (< 50 files): Kernel disabled. Tree-sitter only.
|
|
2175
|
+
- `project` mode (50-1000 files): Full cross-file semantic validation with early exit.
|
|
2176
|
+
- `file` mode (> 1000 files): Semantic checks on edited files only. No cascade.
|
|
2177
|
+
- Mode auto-detected via bounded DFS file counter in ~85ms.
|
|
2178
|
+
- Deferred boot: kernel boots on first edit, not at startup. MCP server starts in 0ms.
|
|
2179
|
+
- Early exit in project mode: stops evaluating after threshold errors (50 + 20 per edited file).
|
|
2180
|
+
- Corrupted builder recovery via warm rebuild (~2-5s) after early exit.
|
|
2181
|
+
- Global noise filter: ignores diagnostic noise from missing @types when editing source files.
|
|
2182
|
+
- Toxicity scoring for TTRD: detects parameter-level regressions (RetryConfig to any).
|
|
2183
|
+
- Structural collapse detection: catches Promise<any> to any.
|
|
2184
|
+
- **VSCode Benchmark (file mode)**: 5,584 files, 91.6s boot, 4.5GB RAM, 0 OOM crashes.
|
|
2185
|
+
- Test A (safe edit): PASS, 23s
|
|
2186
|
+
- Test B (local type break): CAUGHT, 25 errors in event.ts, 55s
|
|
2187
|
+
- Test C (TTRD): CAUGHT via compilation, 1 error, 41s
|
|
2188
|
+
- Test D (IDisposable): CAUGHT, 29 local errors in lifecycle.ts, 98s
|
|
2189
|
+
- Previous project mode: 644s latency, 35,704 errors, OOM crashes
|
|
2190
|
+
|
|
2191
|
+
### Tests
|
|
2192
|
+
- 20 new tests in `tests/mode-modes.test.ts` (mode detection, syntax/file/project behavior, early exit, recovery, elastic threshold, global noise, TTRD toxicity)
|
|
2193
|
+
- 1 new test in `tests/ttrd-silent-crime.test.ts` (silent type degradation)
|
|
2194
|
+
- Total: 590 tests across 29 suites, 0 failures
|
|
2195
|
+
|
|
2196
|
+
---
|
|
2197
|
+
|
|
2198
|
+
## [5.2.0] - 2026-03-18
|
|
2199
|
+
|
|
2200
|
+
### Added
|
|
2201
|
+
- **Chronos Memory**: Cross-session file error tracking with Cognitive Friction Index (CFI)
|
|
2202
|
+
- Exponential decay (λ=0.85) - file friction reduces 15% per clean session
|
|
2203
|
+
- Success discount - successful edits on high-friction files halve their CFI score
|
|
2204
|
+
- JIT warnings - error history appears only when reading/editing affected files
|
|
2205
|
+
- Edit gating - high-friction files require uncompressed read before editing
|
|
2206
|
+
- Blast radius tracking - error penalties go to files where errors occur, not the edited file
|
|
2207
|
+
- Dead file cleanup - deleted files are removed from tracking on session start
|
|
2208
|
+
- Baseline cache reuse - O(1) error counting without compiler invocation
|
|
2209
|
+
- Crash-safe persistence with debounced atomic writes
|
|
2210
|
+
- `NrekiKernel.getInitialErrorCount()` - immutable boot-time error snapshot
|
|
2211
|
+
- `NrekiKernel.getCurrentErrorCount()` - O(1) via baseline cache
|
|
2212
|
+
- Global Health Delta tracking (ΔH = current errors - boot errors)
|
|
2213
|
+
- **Chronos Health Score** in `nreki_guard action:"report"` output
|
|
2214
|
+
- Circuit breaker trips now feed Chronos CFI automatically
|
|
2215
|
+
|
|
2216
|
+
### Tests
|
|
2217
|
+
|
|
2218
|
+
- 16 new tests in `tests/chronos-memory.test.ts`
|
|
2219
|
+
- Constructor, recordTrip/Error/Heal/Success, isHighFriction, passive decay, GC, dead file cleanup, persistence, health report, blast radius tracking
|
|
2220
|
+
|
|
2221
|
+
---
|
|
2222
|
+
|
|
2223
|
+
## v5.1.0 - Zero-Token Error Correction (2026-03-17)
|
|
2224
|
+
|
|
2225
|
+
### New: NREKI L3.3 Auto-Healing Engine
|
|
2226
|
+
|
|
2227
|
+
When the LLM's edit introduces structural errors (missing imports, forgotten `async` keyword, incomplete interface implementations), NREKI now **auto-corrects them in RAM** using TypeScript's CodeFix API - the same engine that powers VS Code's "Quick Fix" lightbulb. The LLM never sees the error. Zero tokens wasted.
|
|
2228
|
+
|
|
2229
|
+
- **`attemptAutoHealing()`**: Iterative fix-recompile loop inside `interceptAtomicBatch()`. Applies one CodeFix at a time, recompiles the universe (~20ms), checks if errors decreased, and either accepts or micro-rollbacks.
|
|
2230
|
+
- **Error reduction rule**: Every fix must reduce total error count. If a fix leaves the same errors or more, it is reverted and blacklisted.
|
|
2231
|
+
- **SAFE_FIXES whitelist**: Only deterministic structural fixes are applied - never type mutations or business logic changes:
|
|
2232
|
+
- `import` / `fixMissingImport` - adds forgotten imports
|
|
2233
|
+
- `fixAwaitInSyncFunction` - adds `async` when LLM wrote `await` without it
|
|
2234
|
+
- `fixPromiseResolve` - wraps returns in `Promise.resolve()`
|
|
2235
|
+
- `fixMissingProperties` - auto-implements required interface properties
|
|
2236
|
+
- `fixClassDoesntImplementInheritedAbstractMember` - implements abstract methods
|
|
2237
|
+
- `fixAddMissingMember` - declares missing class properties
|
|
2238
|
+
- `fixAddOverrideModifier` - adds `override` keyword
|
|
2239
|
+
- **Micro-rollback per fix**: Each fix has its own undo-log. Failed fixes revert without affecting successful ones.
|
|
2240
|
+
- **Macro-rollback on partial failure**: If not ALL errors are resolved, the entire healing attempt is undone and the original errors are returned to the LLM intact.
|
|
2241
|
+
- **Patch protection**: On successful healing, the response tells the agent not to overwrite the auto-applied fixes in the next edit.
|
|
2242
|
+
- **`healedFiles` in response**: Router creates `nreki_undo` backups for collateral files the healer touched.
|
|
2243
|
+
- **`healingStats`**: Public counter tracking `applied` and `failed` healing attempts.
|
|
2244
|
+
|
|
2245
|
+
### New: `getFatalErrors()` - Centralized Triple Shield
|
|
2246
|
+
|
|
2247
|
+
Extracted the 3-shield evaluation logic (Global → Syntactic → Semantic) into a reusable private method. Both `interceptAtomicBatch()` and `attemptAutoHealing()` use it, eliminating code duplication.
|
|
2248
|
+
|
|
2249
|
+
### Bug Fixes
|
|
2250
|
+
|
|
2251
|
+
- **`ts.emptyOptions` doesn't exist in TS 5.9**: Replaced with `{} as ts.UserPreferences`.
|
|
2252
|
+
|
|
2253
|
+
### Tests
|
|
2254
|
+
|
|
2255
|
+
- **526 tests**, 25 suites, zero failures, zero regressions
|
|
2256
|
+
- New: `tests/auto-healing.test.ts` -6 tests covering:
|
|
2257
|
+
- Missing import → auto-healed → `safe: true` → disk has import
|
|
2258
|
+
- `await` without `async`, callers healthy → auto-healed → `safe: true`
|
|
2259
|
+
- `await` without `async`, callers break → cascade detected → micro-rollback → `safe: false`
|
|
2260
|
+
- Business logic error (no CodeFix) → healing skipped → `safe: false`
|
|
2261
|
+
- `healingStats` counter verification
|
|
2262
|
+
- Clean code → healing not triggered → `safe: true` without heal text
|
|
2263
|
+
|
|
2264
|
+
---
|
|
2265
|
+
|
|
2266
|
+
## v5.0.0 - The NREKI Kernel (2026-03-16)
|
|
2267
|
+
|
|
2268
|
+
### New: NREKI Kernel (Layer 2 - Cross-File Semantic Verification)
|
|
2269
|
+
|
|
2270
|
+
- **VFS-LSP Kernel**: Hijacks TypeScript Compiler API with a Virtual File System in RAM. Edits are validated against the entire project's type system before reaching disk.
|
|
2271
|
+
- **True ACID Transactions**: `interceptAtomicBatch()` validates in RAM; `commitToDisk()` writes via two-phase atomic commit (backup → temp+rename → cleanup) with physical rollback on OS failure.
|
|
2272
|
+
- **Zero Disk Touch**: When the kernel is active, `semanticEdit()` operates in `dryRun` mode. The disk is immutable until semantic validation passes.
|
|
2273
|
+
- **Triple Shield**: Global diagnostics → Syntactic diagnostics → Semantic diagnostics. Catches broken syntax AND cross-file type errors.
|
|
2274
|
+
- **Predictive Blast Radius**: `predictBlastRadius()` uses `ts.LanguageService.findReferences()` to show what will break and WHY before the agent edits. ~20ms per query.
|
|
2275
|
+
- **PageRank Architecture Scoring**: Files classified by recursive importance via Markov Chain Power Iteration (damping factor 0.85, 20 iterations, <8ms convergence for 1,000 files). Replaces naive inDegree classification.
|
|
2276
|
+
- **Warm-Path Optimization**: Failed intercepts advance the monotonic clock instead of destroying the builder program. Rollback drops from ~10s to ~50ms.
|
|
2277
|
+
- **Path Jail at Kernel Level**: `interceptAtomicBatch()` rejects paths that resolve outside the project root.
|
|
2278
|
+
- **O(1) Virtual Directory Resolution**: `vfsDirectories` Set replaces O(n) VFS scan in `directoryExists`.
|
|
2279
|
+
- **LanguageService Integration**: VS Code's reference engine connected to the VFS for JIT lazy evaluation.
|
|
2280
|
+
|
|
2281
|
+
### Renamed: TokenGuard → NREKI
|
|
2282
|
+
|
|
2283
|
+
- npm package: `@ruso-0/tokenguard` → `@ruso-0/nreki`
|
|
2284
|
+
- Tool names: `tg_navigate` → `nreki_navigate`, `tg_code` → `nreki_code`, `tg_guard` → `nreki_guard`
|
|
2285
|
+
- Database: `.tokenguard.db` → `.nreki.db`
|
|
2286
|
+
- Pins: `.tokenguard-pins.json` → `.nreki-pins.json`
|
|
2287
|
+
- Backups: `.tokenguard-backup/` → `.nreki-backup/`
|
|
2288
|
+
- Server name: `TokenGuard` → `NREKI`
|
|
2289
|
+
|
|
2290
|
+
### Security Hardening (30/30 Audit Findings Resolved)
|
|
2291
|
+
|
|
2292
|
+
- **A1**: Kernel path jail blocks traversal attempts (`../../etc/passwd`)
|
|
2293
|
+
- **A2**: Write-Then-Validate eliminated - now Validate-Then-Write via dryRun
|
|
2294
|
+
- **A3**: Zombie mutex (`withTimeout`/`Promise.race`) deleted entirely
|
|
2295
|
+
- **A4**: Sensitive file blocklist expanded (+8 patterns: docker, kube, netrc, htpasswd, etc.)
|
|
2296
|
+
- **A5**: `node_modules` filter uses path segment regex, not substring match
|
|
2297
|
+
- **A6**: Kernel returns relative paths in error messages, not absolute
|
|
2298
|
+
- **A8**: Pin sanitization adds Unicode normalization (NFKC) + null byte rejection
|
|
2299
|
+
- **A9**: Prototype pollution guard on pin JSON.parse
|
|
2300
|
+
- **A10**: Kernel readFile blocks sensitive files (.env, .pem, .key) in disk fallback
|
|
2301
|
+
- **B1**: `commitToDisk()` resurrected as the only write path when kernel is active
|
|
2302
|
+
- **B2**: `isTypeScriptFile` regex expanded to `.mts`, `.cts`, `.mjs`, `.cjs`, `.d.mts`, `.d.cts`
|
|
2303
|
+
- **B4**: Double-boot guard added to `boot()`
|
|
2304
|
+
- **B5**: Pre-boot guard added to `interceptAtomicBatch()`
|
|
2305
|
+
- **B6**: `logicalTime` saved and restored on rollback
|
|
2306
|
+
- **B7**: Fingerprint hash upgraded from MD5 to SHA-256
|
|
2307
|
+
- **B8**: GC threshold made configurable (`gcThreshold` property)
|
|
2308
|
+
- **C4**: Heartbeat skipped during circuit breaker escalation ≥ 2
|
|
2309
|
+
- **C5**: Version read from `package.json` at runtime (no hardcoded string)
|
|
2310
|
+
- **D1**: Pin file writes use atomic temp+rename pattern
|
|
2311
|
+
- **D2**: Orphaned `.nreki-bak-*` files cleaned on kernel boot
|
|
2312
|
+
- **D4**: Token estimation margin documented (20-40% variance)
|
|
2313
|
+
- **E1**: `directoryExists` uses O(1) Set lookup instead of O(n) VFS scan
|
|
2314
|
+
|
|
2315
|
+
### Tests
|
|
2316
|
+
|
|
2317
|
+
- **520 tests**, 24 suites, zero failures
|
|
2318
|
+
- New: `tests/nreki-kernel.test.ts` -22 kernel unit tests (boot, semantic validation, syntactic shield, baseline tolerance, file operations, ACID, concurrency, edge cases)
|
|
2319
|
+
- New: `tests/nreki-integration.test.ts` -8 integration tests (dryRun, full commit path, type-break blocked, batch VFS, path traversal rejection)
|
|
2320
|
+
- New: PageRank tests (recursive importance, convergence <50ms for 1,000 files)
|
|
2321
|
+
- New: Precision tests (VFS staging leak, node_modules filtering, restore failure handling)
|
|
2322
|
+
|
|
2323
|
+
### Benchmark: OpenDota (148 files, 1,600+ stars)
|
|
2324
|
+
|
|
2325
|
+
- 6/6 correct verdicts (valid edit, type break, syntax break, file delete, non-TS file)
|
|
2326
|
+
- Zero false positives, zero false negatives
|
|
2327
|
+
- Boot: 10.68s | Type break detection: 12.6s | Syntax detection: 11.4s
|
|
2328
|
+
|
|
2329
|
+
### 32 Sealed Failure Modes (P1-P32)
|
|
2330
|
+
|
|
2331
|
+
P2 (atomic commit), P4 (dynamic rootNames), P5 (tombstone), P8 (monotonic clock), P9 (topological cardinality), P10 (FIFO mutex), P11 (periodic GC), P15 (path sanitization), P17 (zombie AST), P18 (destruction & resurrection), P19 (counter reset), P21 (multi-file deadlock), P25 (idempotent undo-log), P26 (POSIX normalization), P27 (recursive mkdir), P28 (syntactic blindness), P29 (TS6053 ghost), P30 (non-TS filter), P31 (virtual directories), P32 (physical rollback).
|
|
2332
|
+
|
|
2333
|
+
## [4.0.2] - 2026-03-13
|
|
2334
|
+
|
|
2335
|
+
### Fixed (Logic)
|
|
2336
|
+
- **Blind Sniper**: `prepare_refactor` only searched function signatures (BM25 shorthand index), missing symbols used inside function bodies. Now uses exhaustive `raw_code` SQL scan for 100% coverage. Also added `property_identifier` and `shorthand_property_identifier` to the AST node type filter.
|
|
2337
|
+
- **Batch Edit Race Condition**: `batch_edit` had no file locks. Concurrent `edit` + `batch_edit` on the same file could corrupt it. Added two-phase locking (acquire all or rollback all, release in finally).
|
|
2338
|
+
- **indexOf Wrong Function**: `applySemanticSplice` fallback searched from byte 0, could edit the wrong function when duplicates exist. Now searches in a ±500 byte local window around the AST-reported position first.
|
|
2339
|
+
- **extractSignature String Confusion**: `{` inside string literals (e.g., `msg = "{"`) was mistaken for function body start, truncating signatures. Added string-state tracking to skip characters inside quotes.
|
|
2340
|
+
- **Silent Plan Amnesia**: Plans exceeding 15,000 characters were silently dropped. Now injects a visible WARNING telling Claude to summarize the plan.
|
|
2341
|
+
|
|
2342
|
+
### Fixed (Documentation)
|
|
2343
|
+
- Updated `index.ts` docstring from v3.3.0 to v4.0.2.
|
|
2344
|
+
- Rewrote `skills/SKILL.md` with v4 tool names and features (batch_edit, prepare_refactor, blast radius, architecture tiers).
|
|
2345
|
+
- Updated `getClaudeMdContent()` (CLAUDE.md init) with v4 features.
|
|
2346
|
+
- Changed "vs full file rewrite" to "vs native read+edit" in response messages.
|
|
2347
|
+
- Changed "Saves 98%" claim to "60-80%" in semantic-edit docstring.
|
|
2348
|
+
- Eliminated double file read in handleEdit by returning oldRawCode from semanticEdit.
|
|
2349
|
+
- Updated preToolUse.ts docstring to use v4 tool names.
|
|
2350
|
+
|
|
2351
|
+
## [4.0.1] - 2026-03-13
|
|
2352
|
+
|
|
2353
|
+
### Fixed
|
|
2354
|
+
- **Inflated `tokensAvoided` metric**: `semanticEdit()` was computing savings as `fullFile × 2 - newCode`, which double-counted the file read. Corrected to `fullFile + oldSymbol - newCode` (read file + old symbol code that Claude would have sent).
|
|
2355
|
+
- **Router docstring version**: Updated from v3.3.0 to v4.0.0 and added `batch_edit` and `prepare_refactor` to the tool action listings.
|
|
2356
|
+
- **Batch edit blast radius missing dependents**: `handleBatchEdit()` now queries the dependency graph to list files that import edited modules, matching the behavior of single-file `handleEdit()`.
|
|
2357
|
+
|
|
2358
|
+
## [4.0.0] - 2026-03-12
|
|
2359
|
+
|
|
2360
|
+
### BREAKING CHANGES
|
|
2361
|
+
- **`symbolName` extracted from AST**: Parser now uses tree-sitter `@_name` captures instead of ~10 fragile regexes. `ParsedChunk` interface adds `symbolName: string`. Database schema adds `symbol_name`, `start_index`, `end_index` columns (auto-migrated for existing DBs).
|
|
2362
|
+
|
|
2363
|
+
### Added
|
|
2364
|
+
- **`nreki_code action:"batch_edit"`**: Atomically edit multiple symbols across multiple files. Uses Virtual File System in RAM with reverse splice ordering (descending startIndex) to avoid byte offset corruption. All-or-nothing: if ANY file fails AST validation, NOTHING is written to disk.
|
|
2365
|
+
- **Architecture Map**: `nreki_navigate action:"map"` now includes dependency graph with import centrality classification. Files are tiered by in-degree percentile: P75+ = "core", P50-P75 = "logic", <P50 = "leaf". Uses O(1) FastLookup index for import resolution (relative paths, `@/` aliases, extensionless, index.ts implicit).
|
|
2366
|
+
- **Blast Radius Detection**: When `nreki_code action:"edit"` changes a function's signature (parameters, return type), NREKI warns which files import that symbol. Suggests `batch_edit` to update dependents. Also applies to `batch_edit`.
|
|
2367
|
+
- **`nreki_navigate action:"prepare_refactor"`**: AST-based confidence classification for safe renaming. Walks tree-sitter syntax nodes and classifies each occurrence as "high" confidence (safe to rename) or "review" (inside strings, comments, object keys, JSX text). Returns a formatted report with two sections.
|
|
2368
|
+
- **`parseRaw<T>()`**: Public method on `ASTParser` for raw tree-sitter tree access via callback pattern with guaranteed WASM memory cleanup.
|
|
2369
|
+
- **`DependencyGraph` interface**: `importedBy`, `inDegree`, and `tiers` maps exported from `repo-map.ts`.
|
|
2370
|
+
- **`buildFastLookup()`**: O(1) import resolution mapping extensionless, src/-stripped, and index-collapsed variants to actual file paths.
|
|
2371
|
+
- **`detectSignatureChange()`**: Pure function comparing old/new signatures to detect parameter and return type changes.
|
|
2372
|
+
- **`findChunkBySymbol()`**: Extracted pure function preferring `chunk.symbolName` (AST) with `extractName()` regex fallback.
|
|
2373
|
+
- **`applySemanticSplice()`**: Extracted pure splice function for reuse in both single and batch edits.
|
|
2374
|
+
|
|
2375
|
+
### Fixed
|
|
2376
|
+
- **Bug A - Stale docstring**: `engine.ts` header incorrectly referenced "sqlite-vec + FTS5". Updated to reflect actual implementation (pure-JS VectorIndex + BM25 KeywordIndex).
|
|
2377
|
+
- **Bug B - Multi-line console.log stripping**: Regex-based `console.log()` removal failed on multi-line calls. Replaced with `stripCallStatements()` using balanced parenthesis tracking. Same fix applied to Python `print()`.
|
|
2378
|
+
- **Bug C - Python `#` in strings**: Comment stripping destroyed `#` inside string literals (e.g., `color = "#FF0000"`). Fixed by reordering (triple-quotes first) and protecting single/double-quoted strings with placeholders before stripping comments.
|
|
2379
|
+
- **Bug D - Simplistic glob matching**: `walkDirectory` converted `**/node_modules/**` to `node_modules` via string replace, failing for patterns like `**/*.min.js`. Replaced with `picomatch` for proper glob matching.
|
|
2380
|
+
|
|
2381
|
+
### Changed
|
|
2382
|
+
- `semantic-edit.ts` refactored: extracted `applySemanticSplice()`, `findChunkBySymbol()`, `detectSignatureChange()` as pure functions.
|
|
2383
|
+
- `repo-map.ts` extended: `generateRepoMap()` now builds and caches dependency graph alongside repo map. `repoMapToText()` appends architecture tier summary.
|
|
2384
|
+
- Database schema: `chunks` table now stores `start_index`, `end_index`, `symbol_name` with migration for existing DBs.
|
|
2385
|
+
- Test count: 464 → 473 tests across 21 test suites.
|
|
2386
|
+
|
|
2387
|
+
### Dependencies
|
|
2388
|
+
- Added `picomatch` (runtime) and `@types/picomatch` (dev) for proper glob matching.
|
|
2389
|
+
|
|
2390
|
+
## [3.3.0] - 2026-03-13
|
|
2391
|
+
|
|
2392
|
+
### Added
|
|
2393
|
+
- **Context Heartbeat**: Silently re-injects critical session state
|
|
2394
|
+
every ~15 tool calls to survive Claude Code's context compaction. Uses 4-layer
|
|
2395
|
+
state re-injection:
|
|
2396
|
+
- Layer 1 (Plan File): Anchored plan document via `set_plan`
|
|
2397
|
+
- Layer 2 (Scratchpad): Claude's progress notes via `memorize` + pinned rules
|
|
2398
|
+
- Layer 3 (Recent Edits): Files modified in this session
|
|
2399
|
+
- Layer 4 (Circuit Breaker): Active escalation alerts if in Break & Build
|
|
2400
|
+
- **`nreki_guard action:"set_plan"`**: Anchor a master plan file (PLAN.md, schemas).
|
|
2401
|
+
Includes Bankruptcy Shield rejecting plans >4000 tokens to prevent context bloat.
|
|
2402
|
+
- **`nreki_guard action:"memorize"`**: Claude writes progress notes to persistent scratchpad.
|
|
2403
|
+
Notes survive context compaction and are re-injected during heartbeat.
|
|
2404
|
+
- **Top-injection pattern**: Heartbeat injects state ABOVE the tool response, keeping the
|
|
2405
|
+
immediate result at the bottom to respect the LLM's U-shaped attention curve.
|
|
2406
|
+
- **Read-only filter**: Heartbeat only fires during context-gathering actions
|
|
2407
|
+
(read, search, map, status, definition, references, outline). Never during
|
|
2408
|
+
edit, undo, or filter_output to avoid distracting Claude during critical operations.
|
|
2409
|
+
- **Restart Detection**: Heartbeat detects MCP server restarts (currentCalls < lastInjectCalls)
|
|
2410
|
+
and resets the injection counter to prevent permanent heartbeat death.
|
|
2411
|
+
|
|
2412
|
+
## [3.2.0] - 2026-03-13
|
|
2413
|
+
|
|
2414
|
+
### Added
|
|
2415
|
+
- **Auto-Context Inlining**: When Claude requests a definition or reads a file, NREKI
|
|
2416
|
+
automatically resolves signatures of imported dependencies and injects them in the response.
|
|
2417
|
+
Reduces follow-up tool calls by providing "X-ray vision" in a single turn.
|
|
2418
|
+
- Import extraction supports ESM (named + default), CommonJS require, Python from-import,
|
|
2419
|
+
and Go namespace inference.
|
|
2420
|
+
- "Gold Filter": only injects dependencies actually used in the function body, using the
|
|
2421
|
+
local alias name (not the original export name) for accurate matching.
|
|
2422
|
+
- Security filter: signatures containing passwords, API keys, auth tokens, or encryption
|
|
2423
|
+
keys are automatically excluded from injection.
|
|
2424
|
+
- Anti-prompt-injection: JSDoc comments and NREKI stubs are stripped from signatures
|
|
2425
|
+
before injection, preventing malicious content from entering Claude's context.
|
|
2426
|
+
- Homonym disambiguation: BM25 searches combine symbol name + import path hint to find
|
|
2427
|
+
the correct signature even when multiple files export the same name.
|
|
2428
|
+
- 150ms hard timeout prevents event loop blocking on large codebases.
|
|
2429
|
+
- `auto_context: false` parameter available on both `nreki_navigate` and `nreki_code` to disable.
|
|
2430
|
+
- Session report tracks `autoContextInjections` count.
|
|
2431
|
+
- **Go import support**: Auto-Context infers exported symbols from Go namespace usage patterns
|
|
2432
|
+
(e.g., `utils.HashPassword()` resolves to `HashPassword` in the `utils` package).
|
|
2433
|
+
- **Preloaded content in compressFileAdvanced**: Eliminates double file I/O when both
|
|
2434
|
+
auto-context and compression are active on the same read.
|
|
2435
|
+
|
|
2436
|
+
### Changed
|
|
2437
|
+
- `CompressionLevel` type is now used explicitly instead of `as any` for level casting.
|
|
2438
|
+
- `handleRead` reads the file exactly once and reuses the content for both auto-context
|
|
2439
|
+
extraction and compression.
|
|
2440
|
+
|
|
2441
|
+
## [3.1.3] - 2026-03-12
|
|
2442
|
+
|
|
2443
|
+
### Fixed
|
|
2444
|
+
- **Path normalization in Circuit Breaker**: All file paths are now resolved to absolute + forward slashes before recording. Prevents split counters where `"src/app.ts"` and `"/abs/path/src/app.ts"` were tracked as different files, causing Pattern 4 to never trigger.
|
|
2445
|
+
- **Ghost data after file deletion**: `db.save()` is now called after the watcher's `unlink` event, ensuring deleted files don't reappear from disk on next session.
|
|
2446
|
+
- **Plaintext fallback for unsupported languages**: Files with unsupported extensions (.rs, .java, .cpp, etc.) are now indexed as single plaintext chunks. BM25 keyword search works on all file types as documented in the README. AST features (validation, structural compression, semantic edit) still require TS/JS/Python/Go.
|
|
2447
|
+
|
|
2448
|
+
## [3.1.2] - 2026-03-12
|
|
2449
|
+
|
|
2450
|
+
### Fixed
|
|
2451
|
+
- **Duplicate JSDoc on softReset**: Removed stale v3.0 comment that contradicted actual behavior.
|
|
2452
|
+
- **Inflated grepEstimate**: Replaced arbitrary `× 3` multiplier with per-unique-file estimation. Added "(estimated)" to savings output.
|
|
2453
|
+
- **@xenova/transformers moved to optionalDependencies**: `npm install` no longer downloads ~200MB of ONNX runtime for Lite mode users. Pro mode users can install it separately with `npm install @xenova/transformers`.
|
|
2454
|
+
|
|
2455
|
+
## [3.1.1] - 2026-03-12
|
|
2456
|
+
|
|
2457
|
+
### Fixed
|
|
2458
|
+
- **Circuit breaker `redirectsIssued`**: No longer counts Level 3 hard stops as redirects.
|
|
2459
|
+
- **Circuit breaker `softReset` amnesia total**: Purges all history entries for the tripped file, giving Claude 3 clean attempts with the new strategy instead of 1.
|
|
2460
|
+
- **Breaker payloads instruct `compress:false`**: Level 1 and Level 2 redirects now tell Claude to read uncompressed code so it can understand the logic before rewriting.
|
|
2461
|
+
- **Smart rebase for Python/Go**: Auto-indentation now strips Claude's indent and rebases to the target context, fixing IndentationError in Python and tab corruption in Go.
|
|
2462
|
+
- **CRLF support**: Line start detection skips `\r` on Windows files.
|
|
2463
|
+
- **Cross-platform byte indices**: Verifies tree-sitter byte offsets against actual content, falls back to indexOf if they differ across platforms.
|
|
2464
|
+
|
|
2465
|
+
### Added
|
|
2466
|
+
- **Behavioral Advisor (PreToolUseHook)**: Connected to `handleRead` - when Claude reads a file raw (compress:false), it gets a suggestion showing how many tokens it wasted and the exact command to compress next time.
|
|
2467
|
+
- **Danger Zones in status**: `nreki_guard action:"status"` now shows the 5 heaviest unread files with estimated token counts. Files already read (raw or compressed) are filtered out dynamically.
|
|
2468
|
+
- **CLI `--help` and `--version`**: Standard CLI hygiene. Version sourced from single `VERSION` constant.
|
|
2469
|
+
- **Telemetry via social sharing**: Session report footer invites users to share their receipt on GitHub Discussions.
|
|
2470
|
+
- **E2E breaker test**: Full integration test simulating 3 failures → Level 1 redirect → grace period → recovery with insert_after.
|
|
2471
|
+
- **5 topological edit tests**: insert_after, insert_before, auto-indent nested, syntax rejection, last-symbol edge case.
|
|
2472
|
+
|
|
2473
|
+
### Removed
|
|
2474
|
+
- `evaluateGrepOperation` and `countFiles` from PreToolUseHook (unreachable via MCP).
|
|
2475
|
+
- `src/schemas.ts` (dead v2 code, zero imports).
|
|
2476
|
+
- All "BOMBA" comments replaced with professional descriptions.
|
|
2477
|
+
|
|
2478
|
+
### Changed
|
|
2479
|
+
- CLAUDE.md point 3 now includes quantitative advice (5,000 tokens vs 1,200 tokens).
|
|
2480
|
+
- `RouterDependencies.hook` is optional for backward compatibility.
|
|
2481
|
+
- `engine.markFileRead()` called in both compress and raw read branches.
|
|
2482
|
+
|
|
2483
|
+
## [3.1.0] - 2026-03-11
|
|
2484
|
+
|
|
2485
|
+
### Added
|
|
2486
|
+
- **Creative Circuit Breaker ("Break & Build")**: 3-level escalation system that redirects Claude with increasingly specific strategies instead of just blocking. Level 1: rewrite from scratch. Level 2: decompose into helpers. Level 3: hard stop, ask the human.
|
|
2487
|
+
- **`nreki_guard action:"reset"`**: Escape hatch for humans to clear the circuit breaker and let Claude retry with a new approach.
|
|
2488
|
+
- **`npx nreki init`**: CLI subcommand that generates a `CLAUDE.md` file with collaborative-tone instructions for Claude Code to prefer NREKI tools.
|
|
2489
|
+
- **Redirect statistics**: Session report now tracks `redirectsIssued` and `redirectsSuccessful` to measure creative breaker effectiveness.
|
|
2490
|
+
|
|
2491
|
+
### Performance
|
|
2492
|
+
- **Batch SQL queries**: `searchHybrid`, `searchKeywordOnly`, and `searchVector` now use `WHERE id IN (...)` batch queries instead of N+1 individual queries per chunk ID.
|
|
2493
|
+
- **BM25 TF precompute**: Term frequencies are precomputed at index time for O(1) lookup during search, replacing O(n) `filter()` scans.
|
|
2494
|
+
|
|
2495
|
+
### Changed
|
|
2496
|
+
- Circuit breaker `ToolCallRecord` now includes `symbolName` for contextual redirect payloads.
|
|
2497
|
+
- Circuit breaker `trip()` now escalates `escalationLevel` (0→3) instead of just setting a boolean.
|
|
2498
|
+
- `softReset()` preserves escalation level across retries, enabling progressive escalation.
|
|
2499
|
+
- All version strings aligned to 3.1.0.
|
|
2500
|
+
|
|
2501
|
+
### Tests
|
|
2502
|
+
- 438 tests (was 423). Added 15 new tests for escalation levels, redirect payloads, symbolName tracking, and soft/hard reset behavior.
|
|
2503
|
+
|
|
2504
|
+
---
|
|
2505
|
+
|
|
2506
|
+
## [3.0.3] - 2026-03-11
|
|
2507
|
+
|
|
2508
|
+
### Fixed
|
|
2509
|
+
- **CI macOS/Windows**: `safePath` now calls `realpathSync` on the workspace root as well as the resolved path, fixing false-positive "Symlink escape blocked" errors on macOS where `/tmp` is a symlink to `/private/tmp`. All 423 tests pass on all platforms.
|
|
2510
|
+
|
|
2511
|
+
---
|
|
2512
|
+
|
|
2513
|
+
## [3.0.2] - 2026-03-10
|
|
2514
|
+
|
|
2515
|
+
### Headline
|
|
2516
|
+
docs: fix README Quick Start syntax, update test count to 423, update keywords, add security documentation.
|
|
2517
|
+
|
|
2518
|
+
### Fixed
|
|
2519
|
+
- **README Quick Start**: Replaced v2 `options:{}` syntax with v3 flat params (`text:`, `symbol:`, `new_code:`, `output:`).
|
|
2520
|
+
- **README Quick Start**: Replaced `target:` with correct param names (`query:`, `symbol:`).
|
|
2521
|
+
- **README**: Renamed `terminal` → `filter_output` in nreki_code actions table, comparison table, architecture diagram, and Quick Start.
|
|
2522
|
+
- **README**: Updated test count from 361 → 423 in title, badges, stress test section, and real-world validation.
|
|
2523
|
+
- **README**: Updated test suites from 14 → 16.
|
|
2524
|
+
|
|
2525
|
+
### Added
|
|
2526
|
+
- **README Security section**: Documented symlink resolution, sensitive file blocklist, pin sanitization, and file-level mutex.
|
|
2527
|
+
|
|
2528
|
+
### Changed
|
|
2529
|
+
- **package.json**: Updated keywords to reflect v3 security focus (`code-safety`, `ast-validation`, `circuit-breaker`, `defensive-coding`, `ai-safety`, `surgical-edit`).
|
|
2530
|
+
- **package.json**: Set author to `Ruso-0 (https://github.com/Ruso-0)`.
|
|
2531
|
+
- **package.json**: Version bumped to 3.0.2.
|
|
2532
|
+
|
|
2533
|
+
---
|
|
2534
|
+
|
|
2535
|
+
## [3.0.0] - 2026-03-10
|
|
2536
|
+
|
|
2537
|
+
### Headline
|
|
2538
|
+
NREKI v3.0 - Architecture overhaul. 16 tools collapsed to 3 routers. Invisible middleware. Lite/Pro mode. 81% reduction in tool definition overhead.
|
|
2539
|
+
|
|
2540
|
+
### BREAKING CHANGES
|
|
2541
|
+
- **16 tools → 3 router tools**: All MCP tool names have changed. LLMs must use the new `nreki_navigate`, `nreki_code`, `nreki_guard` tool names with `action` parameters.
|
|
2542
|
+
- **`nreki_validate` removed from MCP**: Now runs automatically as invisible middleware inside `nreki_code action:"edit"`. No manual calls needed.
|
|
2543
|
+
- **`nreki_circuit_breaker` removed from MCP**: Now runs as passive middleware monitoring all tool calls. Auto-resets after 60s inactivity or when a different action is called.
|
|
2544
|
+
- **`nreki_audit` removed from MCP**: Moved to CLI only. Use `npx @ruso-0/nreki --audit`.
|
|
2545
|
+
|
|
2546
|
+
### Added - Router Pattern
|
|
2547
|
+
- **`nreki_navigate`** - Unified navigation tool replacing `nreki_search`, `nreki_def`, `nreki_refs`, `nreki_outline`, `nreki_map`. Actions: `search`, `definition`, `references`, `outline`, `map`.
|
|
2548
|
+
- **`nreki_code`** - Unified code tool replacing `nreki_read`, `nreki_compress`, `nreki_semantic_edit`, `nreki_undo`, `nreki_terminal`. Actions: `read`, `compress`, `edit`, `undo`, `terminal` (renamed to `filter_output` in v3.0.2).
|
|
2549
|
+
- **`nreki_guard`** - Unified safety tool replacing `nreki_pin`, `nreki_status`, `nreki_session_report`. Actions: `pin`, `unpin`, `status`, `report`.
|
|
2550
|
+
- `src/router.ts` - Central dispatcher mapping `{tool, action}` to handler functions (~700 lines).
|
|
2551
|
+
|
|
2552
|
+
### Added - Invisible Middleware
|
|
2553
|
+
- `src/middleware/validator.ts` - AST validation wrapper. Validates code via tree-sitter before disk writes inside `nreki_code action:"edit"`.
|
|
2554
|
+
- `src/middleware/circuit-breaker.ts` - Passive circuit breaker. Wraps all handlers, records tool call results, trips on destructive patterns, auto-resets on action diversity or 60s inactivity.
|
|
2555
|
+
|
|
2556
|
+
### Added - Lite / Pro Mode
|
|
2557
|
+
- **Lite mode (default)**: Instant startup (~100ms). BM25 keyword-only search. No ONNX model dependency.
|
|
2558
|
+
- **Pro mode (`--enable-embeddings`)**: Hybrid semantic + BM25 search with RRF fusion. Requires ONNX Runtime for jina-v2-small embeddings.
|
|
2559
|
+
- `searchKeywordOnly()` method added to `NREKIDB` for Lite mode BM25 search.
|
|
2560
|
+
- Engine methods (`indexFile`, `indexDirectory`, `search`, `getRepoMap`) now branch based on `enableEmbeddings` config.
|
|
2561
|
+
|
|
2562
|
+
### Changed
|
|
2563
|
+
- **`src/index.ts`**: Rewritten from ~1,479 lines (16 tool registrations) to ~180 lines (3 router registrations).
|
|
2564
|
+
- **Tool definition overhead**: ~3,520 tokens → ~660 tokens (81% reduction).
|
|
2565
|
+
- **Test count**: 305 → 361 tests across 14 test suites.
|
|
2566
|
+
- **`package.json`**: Version bumped to 3.0.0. Description updated.
|
|
2567
|
+
- **`README.md`**: Complete rewrite for v3.0 architecture.
|
|
2568
|
+
|
|
2569
|
+
### Added - Tests
|
|
2570
|
+
- `tests/router.test.ts` - 30 tests for router dispatch correctness across all 14 `{tool, action}` pairs.
|
|
2571
|
+
- `tests/middleware.test.ts` - 13 tests for validator and circuit breaker middleware behavior.
|
|
2572
|
+
- `tests/backward-compat.test.ts` - 13 tests verifying all 16 original tool behaviors work through the new 3-tool API.
|
|
2573
|
+
|
|
2574
|
+
---
|
|
2575
|
+
|
|
2576
|
+
## [2.1.2] - 2026-03-10
|
|
2577
|
+
|
|
2578
|
+
### Headline
|
|
2579
|
+
NREKI v2.1.2 - Lazy ONNX loading fixes MCP handshake timeout for real-world users.
|
|
2580
|
+
|
|
2581
|
+
### Fixed
|
|
2582
|
+
- **CRITICAL - MCP handshake timeout**: `engine.initialize()` was eagerly loading the ONNX embedding model (~5-10s) during startup, blocking ALL tool calls until the model was ready. Real users connecting via Claude Code would experience timeouts or slow first responses. Split initialization into two phases:
|
|
2583
|
+
- **Fast path** (`initialize()`): SQLite + Tree-sitter only (~100ms). Used by 12/16 tools.
|
|
2584
|
+
- **Embedder path** (`initializeEmbedder()`): Adds ONNX model load. Used only by `nreki_search`, `nreki_map`, and indexing operations.
|
|
2585
|
+
- **`nreki_def` first-call latency**: Was 465ms because it waited for the embedder to load (which it doesn't use). Now completes in ~50ms on first call.
|
|
2586
|
+
- Removed background `engine.initialize()` from `main()` - tools now self-initialize at the correct level when first called.
|
|
2587
|
+
|
|
2588
|
+
### Changed
|
|
2589
|
+
- **package.json**: Version bumped to 2.1.2.
|
|
2590
|
+
|
|
2591
|
+
---
|
|
2592
|
+
|
|
2593
|
+
## [2.1.1] - 2026-03-10
|
|
2594
|
+
|
|
2595
|
+
### Headline
|
|
2596
|
+
NREKI v2.1.1 - Final audit fixes, nreki_undo, 16 tools, 305 tests.
|
|
2597
|
+
|
|
2598
|
+
### Added - New Tool
|
|
2599
|
+
- **`nreki_undo`** - Undo the last `nreki_semantic_edit` on a file. Auto-restores from backup with one-shot semantics (backup is consumed after restore).
|
|
2600
|
+
|
|
2601
|
+
### Added - New Module
|
|
2602
|
+
- `src/undo.ts` - Backup/restore engine using base64url-encoded file paths. Stores pre-edit snapshots in `.nreki/backups/`.
|
|
2603
|
+
- `src/utils/read-source.ts` - Shared BOM-safe file reader. Strips U+FEFF byte order marks from Windows-created source files.
|
|
2604
|
+
|
|
2605
|
+
### Security
|
|
2606
|
+
- **FIX 2 - XML injection prevention**: Pin content is now escaped (`&`, `<`, `>`, `"`, `'`) before storage to prevent prompt injection via pinned rules.
|
|
2607
|
+
|
|
2608
|
+
### Fixed
|
|
2609
|
+
- **FIX 1 - BOM stripping**: All source file readers now use `readSource()` to strip U+FEFF BOM, fixing parse failures on Windows-created files.
|
|
2610
|
+
- **FIX 3 - Code tokenizer**: Rewritten to correctly handle `$scope`, `__proto__`, `_privateVar`, and other edge-case identifiers with `$`/`_` prefixes.
|
|
2611
|
+
- **FIX 4 - Fast dot product**: Replaced cosine similarity with direct dot product for L2-normalized vectors. Removes sqrt/division overhead; mathematically equivalent for unit vectors.
|
|
2612
|
+
- **FIX 6 - Pin order**: Pinned rules now appear AFTER repo map text (was before). Preserves Anthropic prompt cache hits since the static map stays at the start of context.
|
|
2613
|
+
- **FIX 7 - Circuit breaker normalization**: `hashError()` now normalizes ISO timestamps and improved memory address normalization. Added 5-minute TTL eviction to prevent stale errors from tripping the breaker.
|
|
2614
|
+
- **FIX 8 - ASCII receipt**: Replaced all Unicode box-drawing characters and emojis in session receipt and reports with ASCII equivalents for terminal compatibility.
|
|
2615
|
+
|
|
2616
|
+
### Changed
|
|
2617
|
+
- **Tool count**: 15 -> 16 MCP tools.
|
|
2618
|
+
- **Test count**: 282 -> 305 tests across 11 test suites.
|
|
2619
|
+
- **nreki_map**: Pinned rules now appended after repo map (was prepended before).
|
|
2620
|
+
- **package.json**: Version bumped to 2.1.1.
|
|
2621
|
+
|
|
2622
|
+
---
|
|
2623
|
+
|
|
2624
|
+
## [2.1.0] - 2026-03-10
|
|
2625
|
+
|
|
2626
|
+
### Headline
|
|
2627
|
+
NREKI v2.1 - 15 MCP tools, 282 tests, circuit breaker, surgical edit, pin memory, session receipt.
|
|
2628
|
+
|
|
2629
|
+
### Added - New Tools
|
|
2630
|
+
- **`nreki_semantic_edit`** - Surgically edit a function/class/interface by name without reading or rewriting the entire file. Finds the exact AST node, replaces only those bytes, validates syntax before saving. Saves 98% of output tokens vs full file rewrites.
|
|
2631
|
+
- **`nreki_circuit_breaker`** - Detects infinite failure loops (same error 3+ times, same file 5+ times, write-test-fail cycles). When tripped, forces Claude to stop and ask the human for guidance. Prevents doom loops that burn through remaining context.
|
|
2632
|
+
- **`nreki_pin`** - Pin important rules Claude should never forget. Pinned items are injected into every `nreki_map` response, keeping project conventions permanently in Claude's attention window. Max 10 pins, 200 chars each, persisted to disk.
|
|
2633
|
+
|
|
2634
|
+
### Added - New Modules
|
|
2635
|
+
- `src/semantic-edit.ts` - Zero-read surgical AST patching. Symbol name lookup, byte-level splice, syntax validation before write.
|
|
2636
|
+
- `src/circuit-breaker.ts` - Loop detection engine with sliding window analysis, consecutive failure tracking, and automatic trip/reset.
|
|
2637
|
+
- `src/pin-memory.ts` - Persistent pinned rules with deterministic output (sorted by id) for prompt cache compatibility.
|
|
2638
|
+
|
|
2639
|
+
### Added - Session Receipt
|
|
2640
|
+
- `nreki_session_report` now generates an ASCII receipt showing input tokens saved, output tokens avoided, search queries, surgical edits, syntax errors blocked, doom loops prevented, pinned rules active, estimated USD savings, and model info.
|
|
2641
|
+
|
|
2642
|
+
### Changed
|
|
2643
|
+
- **Tool count**: 12 -> 15 MCP tools.
|
|
2644
|
+
- **Test count**: 194 -> 282 tests across 11 test suites.
|
|
2645
|
+
- **nreki_map**: Now prepends pinned rules at the top of the repo map output.
|
|
2646
|
+
- **README**: Complete rewrite for v2.1 with comparison table, 3 unique features highlight, receipt preview, and updated architecture diagram.
|
|
2647
|
+
- **package.json**: Version bumped to 2.1.0.
|
|
2648
|
+
|
|
2649
|
+
### Architecture
|
|
2650
|
+
- **Pin memory layer**: Pinned rules are stored in `.nreki/pins.json` and prepended to every `nreki_map` response. Deterministic output (sorted by id) preserves prompt cache compatibility.
|
|
2651
|
+
- **Circuit breaker integration**: `nreki_terminal` automatically feeds errors to the circuit breaker for proactive loop detection.
|
|
2652
|
+
|
|
2653
|
+
## [2.0.0] - 2026-03-10
|
|
2654
|
+
|
|
2655
|
+
### Headline
|
|
2656
|
+
NREKI v2.0 - 12 MCP tools, 194 tests, cache-aware two-layer architecture.
|
|
2657
|
+
|
|
2658
|
+
### Added - New Tools
|
|
2659
|
+
- **`nreki_def`** - Go-to-definition by symbol name. AST-based, 100% precise, returns full source body with signature.
|
|
2660
|
+
- **`nreki_refs`** - Find all references to a symbol across the project. Cross-file word-boundary matching with context.
|
|
2661
|
+
- **`nreki_outline`** - List all symbols in a file with kind, signature, export status, and line ranges. Like VS Code Outline.
|
|
2662
|
+
- **`nreki_validate`** - AST sandbox validator. Parses code with tree-sitter before disk write. Catches missing commas, unclosed braces, invalid syntax with exact line/column and fix suggestions. Prevents the "write broken code → see error → retry" token burn loop.
|
|
2663
|
+
|
|
2664
|
+
### Added - New Modules
|
|
2665
|
+
- `src/ast-navigator.ts` - AST navigation engine for nreki_def, nreki_refs, nreki_outline. Walks project files, extracts symbols, signatures, export status.
|
|
2666
|
+
- `src/ast-sandbox.ts` - AST sandbox validator with `validateCode()` and `validateDiff()`. Recursive tree walk with `hasError` subtree pruning for large-file performance.
|
|
2667
|
+
- `src/terminal-filter.ts` - Terminal entropy filter. Strips ANSI codes, deduplicates stack traces, extracts unique errors and affected files. 89% token reduction on error output.
|
|
2668
|
+
- `src/repo-map.ts` - Static deterministic repo map for Anthropic prompt cache optimization. Identical output for same repo state enables $0.30/M caching vs $3.00/M input.
|
|
2669
|
+
|
|
2670
|
+
### Changed
|
|
2671
|
+
- **Embeddings**: Migrated from all-MiniLM-L6-v2 (384-dim) to jina-embeddings-v2-small-en (512-dim) for 3x better code search precision.
|
|
2672
|
+
- **BM25 tuning**: Optimized k1=1.8, b=0.35 for code (vs default k1=1.2, b=0.75 for prose).
|
|
2673
|
+
- **RRF tuning**: k=10 for sharper rank fusion (vs k=60 default).
|
|
2674
|
+
- **Code tokenizer**: camelCase, snake_case, PascalCase identifiers split into sub-tokens for better BM25 matching.
|
|
2675
|
+
- **Tool count**: 6 → 12 MCP tools.
|
|
2676
|
+
- **Test count**: 90 → 194 tests across 8 test suites.
|
|
2677
|
+
- **README**: Complete rewrite with self-benchmark results, two-layer architecture docs, and updated comparison table.
|
|
2678
|
+
|
|
2679
|
+
### Architecture
|
|
2680
|
+
- **Two-layer design**: Layer 1 (static repo map, prompt-cacheable) + Layer 2 (dynamic context, per-query).
|
|
2681
|
+
- **Cache-friendly**: nreki_map output is deterministic - same repo state produces identical text, enabling Anthropic prompt caching.
|
|
2682
|
+
|
|
2683
|
+
### Performance (Self-Benchmark)
|
|
2684
|
+
- nreki_search: 10 results in 16ms (hybrid RRF fusion)
|
|
2685
|
+
- nreki_def: Definition lookup in 128ms across 22 files
|
|
2686
|
+
- nreki_refs: 20 references found in 11ms
|
|
2687
|
+
- nreki_outline: 25 symbols extracted in 7ms
|
|
2688
|
+
- nreki_compress: 5,502 → 1,753 tokens (68% reduction, medium level)
|
|
2689
|
+
- nreki_terminal: 11,967 → 1,276 tokens (89% reduction)
|
|
2690
|
+
- nreki_validate: Syntax error detection with line/column in <1ms
|
|
2691
|
+
- nreki_map: 22 files mapped, 4,677 tokens, 169ms
|
|
2692
|
+
|
|
2693
|
+
## [1.2.0] - 2026-03-10
|
|
2694
|
+
|
|
2695
|
+
### Security
|
|
2696
|
+
- **Path traversal protection**: All file operations now validate paths stay within workspace root (`safePath`)
|
|
2697
|
+
- **Input validation**: All tool inputs validated with Zod schemas before processing
|
|
2698
|
+
- **File size limits**: Files > 500KB and binary/minified files are automatically skipped
|
|
2699
|
+
|
|
2700
|
+
### Fixed
|
|
2701
|
+
- **WASM memory leaks**: Tree-sitter parse trees now guaranteed cleanup via `safeParse` try/finally wrapper
|
|
2702
|
+
- **Event loop blocking**: Large indexing operations now yield every 100 files via `setImmediate`
|
|
2703
|
+
- **Aggressive compression stubs**: Functions now show line count, key references, and expand commands instead of empty bodies
|
|
2704
|
+
- **Search tokenization**: Code identifiers (camelCase, snake_case, PascalCase) are now split into sub-tokens for better matching
|
|
2705
|
+
- **Vector search accuracy**: Cosine similarity now uses proper norm computation instead of raw dot product
|
|
2706
|
+
- **RRF scoring**: Verified correct rank-based fusion (was already using positions, not scores)
|
|
2707
|
+
|
|
2708
|
+
### Added
|
|
2709
|
+
- `src/utils/path-jail.ts` - Path traversal protection
|
|
2710
|
+
- `src/utils/safe-parse.ts` - WASM memory-safe parsing
|
|
2711
|
+
- `src/utils/file-filter.ts` - File size and extension filtering
|
|
2712
|
+
- `src/utils/code-tokenizer.ts` - Code-aware identifier tokenization
|
|
2713
|
+
- `src/schemas.ts` - Zod validation schemas for all tools
|
|
2714
|
+
- `.github/workflows/ci.yml` - CI/CD with matrix testing (3 OSes × 3 Node versions)
|
|
2715
|
+
- `CONTRIBUTING.md` - Contributor guide
|
|
2716
|
+
- `CHANGELOG.md` - This file
|
|
2717
|
+
- `.github/ISSUE_TEMPLATE/bug_report.md`
|
|
2718
|
+
- `.github/ISSUE_TEMPLATE/feature_request.md`
|
|
2719
|
+
- Comprehensive test suite for all new utilities
|
|
2720
|
+
|
|
2721
|
+
### Performance
|
|
2722
|
+
- Pre-computed vector norms at index time (avoids recalculation during search)
|
|
2723
|
+
- Proper cosine similarity with normalized vectors
|
|
2724
|
+
|
|
2725
|
+
## [1.1.1] - 2026-03-09
|
|
2726
|
+
|
|
2727
|
+
### Initial Release
|
|
2728
|
+
- MCP server with 6 tools: nreki_search, nreki_audit, nreki_compress, nreki_status, nreki_session_report, nreki_read
|
|
2729
|
+
- Hybrid RRF search (BM25 + vector similarity)
|
|
2730
|
+
- Three-tier classic compression + LLMLingua-2-inspired advanced compression
|
|
2731
|
+
- Real-time file watching with chokidar
|
|
2732
|
+
- Token consumption monitoring and burn rate prediction
|
|
2733
|
+
- Pre-tool-use interception hook
|