Skip to content

Releases: Ruso-0/Nreki

v11.4.2 — DRY path-guard + EISDIR coverage + search fallback hints

Choose a tag to compare

@Ruso-0 Ruso-0 released this 20 May 00:23

Summary

Closes the user-feedback gaps from v11.4.1. Two genuine EISDIR crashes (set_plan, engram) and two UX gaps (outline silent-fail, search "no results" asymmetry) reproduced empirically against the installed v11.4.1 binary and fixed.

Why

User reported four limitations after using v11.4.1 in production:

  1. compress on a directory crashes with EISDIR
  2. Pre-existing TS1259/TS2802 errors block unrelated edits
  3. outline returns misleading "no symbols found" message on a directory
  4. search falls through to native grep when it returns no results

Empirical investigation against the installed binary classified each:

  • (1) and (2) → already fixed in v11.4.0/v11.4.1, the user's reports were retrospective.
  • (3) → UX silent-fail bug (the EISDIR was being absorbed by getFileSymbols's internal try/catch, producing an unhelpful message).
  • Two new bugs surfaced during the audit that the user hadn't named yet: set_plan and engram with a directory path genuinely crash in v11.4.1.

See docs/user-feedback-v11.4.1-investigation.md for the per-claim empirical write-up.

What's fixed

Genuine bugs in v11.4.1

  • nreki_guard action:"set_plan" text:"<dir>" no longer throws EISDIR. Returns structured error pointing to "pass the path to your plan file, e.g. set_plan text:\"PLAN.md\"".
  • nreki_guard action:"engram" path:"<dir>" same fix.

UX in v11.4.1

  • nreki_navigate action:"outline" path:"<dir>" returns "outline operates on a single file. For directory-wide discovery, use search / fast_grep / hybrid_search" instead of the misleading "no symbols found".
  • nreki_navigate action:"search" "No semantic results found" response now lists fallbacks (fast_grep, hybrid_search with the user's query pre-filled, broaden-query, Bash grep as last resort). Symmetric with the existing "Index pending" branch.

Internals

  • New helper src/utils/path-guard.tsvalidatePath() returns {ok, kind, error, hint} for six failure modes (missing, directory, fifo, device, symlink loop, other). Hint text branches on toolName so each handler suggests the right alternative tool.
  • handleRead and handleCompress refactored to use the helper (DRY win, no behavior change vs v11.4.0).
  • handleSetPlan, handleEngram, handleOutline now call the helper at handler entry.

Honest process disclosure

v11.4.0's EISDIR fix should have audited every readSource callsite. It audited only the two it touched. v11.4.2 audited all of them and applies the guard via the new DRY helper. The v11.4.0 sprint Furia review (docs/furia-v11.4.0-review.md §Q5) had already logged FIFO/device-file handling as a residual gap; v11.4.2 closes it too.

Tests

1 441 passed / 4 skipped (3 pre-existing + 1 POSIX FIFO) / 0 failed. +14 vs v11.4.1.

New test files:

  • tests/path-guard.test.ts — 6 unit tests + 1 POSIX-only FIFO test.
  • tests/handlers-eisdir-coverage.test.ts — 5 router-level regression tests.
  • tests/search-no-results-hint.test.ts — 2 search UX tests.

Migration

No API change, no behavioral change vs v11.4.1 on valid file paths. Users who pass directory paths to set_plan, engram, or outline now see a clean error instead of a crash / misleading message.

🤖 Generated with Claude Code

v11.4.1 — Phase 1.5: hologram-mode verification + honest closure

Choose a tag to compare

@Ruso-0 Ruso-0 released this 19 May 23:28

Summary

Closes the test-coverage gap from v11.4.0 honestly. No runtime change — v11.4.1 strictly adds tests and documentation on top of v11.4.0.

Why

A post-v11.4.0 self-audit (docs/v11.4.0-self-exploration.md) flagged two real problems:

  1. Phase 1 tests ran only in project mode. The MCP server's default is hologram (detectMode(cwd) in src/index.ts:308). The per-transaction captureBaseline(filesToEvaluate, mode) scoping in hologram could in principle leak pre-existing errors that the project-mode suite would not catch.
  2. The "TS1259-style" test in v11.4.0 empirically dispatched TS1192, not TS1259. A TS-compiler probe showed TS1259 specifically requires esModuleInterop:true + allowSyntheticDefaultImports:false + export = source — none of which my original test used. The CHANGELOG line claiming "exact scenario coverage" was technically misleading.

This release fixes the test gap and corrects the wording.

What's in v11.4.1

Added

  • tests/kernel-pre-existing-errors-hologram.test.ts — 4 hologram-mode tests:

    • Pre-existing TS1259 + unrelated-symbol edit → safe=true.
    • Pre-existing TS2802 (target:ES5 + downlevelIteration:false + Set iteration) + unrelated-symbol edit → safe=true.
    • JIT-specific: target file enters rootNames only at edit time → still filters correctly.
    • Counter-test: new TS2322 on top of pre-existing TS1259 → safe=false, structured error contains TS2322 (not TS1259).
  • docs/hologram-mode-verify.md — empirical PASS report for the hologram-mode round.

  • docs/v11.4.0-self-exploration.md — honest 10-finding self-audit that drove Phase 1.5. Includes the items I'm still uncomfortable with (code duplication, mocked deps, self-Furia not independent, etc.) for the next iteration.

Verified empirically (no kernel change)

The differential filter at src/kernel/backends/ts-compiler-wrapper.ts:611 holds in hologram mode for TS1259 and TS2802 specifically. The user's original bug report most likely ran against the globally installed @ruso-0/nreki@10.19.0; the fix had shipped in an earlier release.

Tests

1 427 passed / 3 skipped / 0 failed (+4 vs v11.4.0).

Migration

No API change, no file format change, no behavioral change vs v11.4.0. Users on v11.4.0 do not need to upgrade unless they want the new test coverage in their fork or want to read the audit docs.

The v11.4.0 tag at commit 984c781 is preserved unchanged.

🤖 Generated with Claude Code

v11.4.0 — EISDIR fix + regression guards for pre-existing TS errors

Choose a tag to compare

@Ruso-0 Ruso-0 released this 19 May 22:23

Summary

Two user-reported issues addressed:

  1. nreki_code action:"read" / "compress" crashed with EISDIR when the path was a directory. Both handlers now stat the path first and return a structured error pointing to the correct tool. Same fix also catches ENOENT for missing files.
  2. Pre-existing TS errors in an edited file appeared to block unrelated edits. Investigation showed the differential check (count > baseline.get(fingerprint) in src/kernel/backends/ts-compiler-wrapper.ts:611) was already working in v11.3.x — the user's installed binary was likely an older release. v11.4.0 ships regression tests that pin the same-file scenario so a refactor cannot silently break the filter.

Why

The EISDIR was a clean, reproducible bug — fs.readFileSync on a directory throws an opaque error that surfaced as an MCP server crash with no actionable user-facing message.

The pre-existing-error report turned out to be a non-bug in v11.3.x, but the existing test suite only covered the cross-file case (error in bad.ts, edit in good.ts). The user's actual scenario — pre-existing error in fillTemplate.ts, edit a different symbol in fillTemplate.ts — was not pinned by any test. This release adds four explicit tests for that exact case.

Changes

Fixed

  • handleRead / handleCompress now reject directory inputs cleanly with a hint pointing to nreki_navigate action:"outline" / "fast_grep" / "search". ENOENT also gets a structured "Path not found" message.

Added

  • tests/read-compress-directory.test.ts — 4 tests covering directory + missing-file in both handlers.
  • tests/kernel-pre-existing-errors.test.ts — 4 tests pinning same-file pre-existing-error + unrelated-symbol edit (TS2322, TS1192-family, same-symbol no-change, counter-test for genuine new error).
  • docs/furia-v11.4.0-review.md — adversarial Q1-Q5 review covering why Phase 1 added only tests, why Option A (explicit error) beats Option B (auto-redirect), and two residual gaps logged for a future iteration.

Templates

  • templates/CLAUDE.md, templates/AGENTS.md, templates/SKILL.md updated with notes on the differential check semantics and the new directory-input behavior.

Tests

1 423 passed / 3 skipped / 0 failed. +8 tests vs v11.3.1.

Migration

No API change, no file format change, no breaking signature.

🤖 Generated with Claude Code

v11.3.1 — SYMBOL_REPLACE_LIMIT empirical recalibration

Choose a tag to compare

@Ruso-0 Ruso-0 released this 19 May 20:02

Summary

Empirical recalibration of NREKI's mode:"replace" symbol-size cap. Default raised from 40 L → 100 L, now configurable via NREKI_SYMBOL_LIMIT env override.

The legacy 40 L value was introduced in v9.1 (commit 3661c31) as a magic number with no measurement. v11.3.1 replaces it with a value derived from a 2 880-function empirical study.

Why

Phase 1 measurement across 5 production TypeScript codebases (NREKI src/, zod, ajv, eventsource, ajv-formats):

Threshold % real-world functions blocked % NREKI's own src/ blocked
40 L (legacy) 10.45% 19.06% (self-inconsistency)
80 L 4.20% 8.01%
100 L (new default) 3.02% 5.52%

Aggregate p95 of real functions = 66 L; p99 = 146 L. The 40 L cap was rejecting legitimate medium-sized functions (the user's reported case: 55 L processText).

NREKI's 10 other defense-in-depth gates (anti-sweep shield, kernel TS validation, TTRD, blast radius, Fiedler bridge, Chronos friction, auto-backup, ACID, file lock, topology invalidate) continue to detect every defect class the size-only gate was incidentally catching. Raising 40 → 100 weakens no defect-detection gate.

Changes

  • SYMBOL_REPLACE_LIMIT — central named constant in src/limits.ts, replacing the magic 40 in src/semantic-edit.ts:638 (batch) and src/semantic-edit.ts:1029 (single).
  • NREKI_SYMBOL_LIMIT env — integer 1..1000, clamps at the ceiling, warns + falls back on parse failure (never silently disables the gate). Backward-compat for legacy 40 L behavior: NREKI_SYMBOL_LIMIT=40.
  • Error message now reports the active threshold and the env override path.
  • Templates (CLAUDE.md, AGENTS.md, SKILL.md) updated to document the new default.
  • Tests: 3 new cases (55 L allowed, 120 L still blocked, dynamic error message). Full suite: 1415 passed / 3 skipped / 0 failed.

Documentation

Migration

No file format change, no API change, no breaking signature. Symbols 41-100 L now accept mode:"replace" where they were previously rejected.

To restore exact pre-v11.3.1 behavior:

export NREKI_SYMBOL_LIMIT=40

🤖 Generated with Claude Code

v11.2.0 — Hybrid Runtime Integration (Phase 5.5.2)

Choose a tag to compare

@Ruso-0 Ruso-0 released this 18 May 22:46

Added

  • Hybrid Runtime Integration: New nreki_navigate action="hybrid_search" exposes the Type Ledger semantic + BM25 lexical fusion (RRF) documented in the Phase 5 paper to the production MCP runtime. Previously only reachable via eval scripts.
  • src/bm25-engine.ts: BM25 lexical retrieval migrated from scripts/eval-phase5/runners/bm25-runner.ts. Standard Okapi (k1=1.5, b=0.75); code-aware tokenization (PascalCase / snake_case / camelCase decomposition, 2-char minimum). Lazy in-memory index built on first search(); invalidated on indexFile() / indexDirectory() mutations.
  • src/hybrid-engine.ts: Hybrid RRF engine. Calls NREKI semantic search + BM25 in parallel, fuses file rankings via Reciprocal Rank Fusion (k=60), deterministic tie-break by localeCompare. Returns unified results with source: "nreki" | "bm25" | "both" origin tracking.
  • Foveal compression on BM25-only files (Reto 5): Files surfaced exclusively by BM25 (≥100 lines) receive tfcCompress with a focus symbol extracted from the query.
  • NrekiEngine.getHybridEngine() + invalidateHybridIndex(): lazy-construction of the hybrid stack; BM25 cache auto-invalidates on indexFile() and indexDirectory().
  • BM25EngineOptions.excludedDirs: configurable directory exclusion. Default excludes node_modules, .git, .nreki, dist, build, coverage, .next, __pycache__, corpus, plus any dot-prefixed directory.
  • scripts/benchmark-hybrid-smoke.ts: reproducible dogfood smoke bench (action="search" vs action="hybrid_search").
  • docs/sprint-6.5-empirical.md: honest Sprint 6.5 empirical findings + N=99 PolyBench re-bench deferral disclosure.
  • 28 new tests: tests/bm25-engine.test.ts (16) + tests/hybrid-engine.test.ts (12). Full suite: 1384 pass.

Changed

  • nreki_navigate action enum: hybrid_search added to MCP schema + router. Existing 10 actions (search, fast_grep, definition, references, outline, map, prepare_refactor, orphan_oracle, type_shape, type_graph) preserved — backward compatible.

Empirical findings (honest)

  • Dogfood smoke (73 files, 8 queries): search recall 60% vs hybrid_search recall 60% (Δ=0pp). Hybrid pays 207% token overhead with no recall gain on this micro-corpus. Expected — Sprint 6.4 paper's +15pp FHR gain was measured on N=99 diverse external repos.
  • Sprint 6.5 N=99 PolyBench re-benchmark: DEFERRED. Reason: eval orchestrator needs re-plumbing to invoke production HybridEngine; multi-hour wall clock. Tracked as Sprint 6.5.1 in docs/sprint-6.5-empirical.md.

Architectural decision

"El mejor que se quede" — hybrid USES the underlying retrievers, does NOT replace them. Users still pick search for pure topological queries (lower tokens) and hybrid_search for accuracy-critical retrieval (≈3-5x tokens per Sprint 6.4 paper; dogfood shows up to ~3x).

v11.1.0 — Token Economics Refinement (Phase 5.5.1)

Choose a tag to compare

@Ruso-0 Ruso-0 released this 18 May 22:45

Added

  • Real BPE tokenizer: tiktoken cl100k_base integration via src/utils/token-estimator.ts. Replaces chars/3.5 heuristic for token cost estimation. Heuristic preserved as fallback (zero-downtime). Empirical verification: 72-file benchmark 276,516 raw → 60,732 compressed = 78% savings sostained con real BPE tokenizer.
  • Defense-in-depth conditional compression: compressor-level bypass for files <100 lines OR <1024 bytes (src/compressor-foveal.ts:102-123). Complements existing handler-level bypass (src/handlers/code/read.ts:84). Zero overhead instances confirmed empirically across all file-size buckets (72 files tested).
  • bySize SessionReport field: per-file-size tracking buckets (<100L, 100-299L, 300-999L, ≥1000L) in engine.getSessionReport() output.
  • Empirical benchmark scripts: scripts/benchmark-token-economics.ts + scripts/simulate-claude-session.ts for ongoing verification.
  • Token economics empirical verify documentation: docs/token-economics-empirical-verify.md.

Changed

  • Template adelgazamiento:
    • templates/CLAUDE.md 3,965 → 1,670 bytes (495 BPE tokens, ~58% reduction)
    • templates/AGENTS.md 3,885 → 1,253 bytes (372 BPE tokens, ~68% reduction)
    • Combined 867 BPE tokens (~61% reduction, ~8% over Apr 2026 target of 800 combined tokens, honest disclosure).
  • Token cost estimation accuracy: real BPE replaces direccional-but-imprecise chars/3.5 heuristic. Heuristic validated within ~10% magnitude accuracy of real BPE empírico.

Deferred

  • Phase 5.5.2: Hybrid runtime integration → shipped in v11.2.0.
  • Phase 5.5.3: Comparative head-to-head benchmarks (NREKI vs Corsa, Zilliz Claude Context, codebase-memory-mcp, GitNexus).

v10.5.1 — Dynamic Risk Expansion

Choose a tag to compare

@Ruso-0 Ruso-0 released this 15 Apr 15:21

10.5.1 (2026-04-15) — Dynamic Risk Expansion

Changed

  • 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.
  • Warning [BUDGET LIMIT REACHED] con lista de los primeros 8 símbolos omitidos y comando nreki_code action:"compress" focus:"..." listo para copiar.
  • 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.

Fixed

  • computeTriageRisk filtro anti-trivialidad: símbolos de ≤3 líneas ahora restan 2 al score. Evita marcar getters/constantes/exports triviales como HIGH-risk.

Docs

  • 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].

Tests

  • 729/729 pasan (45 archivos, ~142s).

v10.5.0 — Pre-Launch Security Hardening

Choose a tag to compare

@Ruso-0 Ruso-0 released this 15 Apr 15:20

10.5.0 (2026-04-15) — Pre-Launch Security Hardening

Security (Critical)

  • 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.
  • SQL injection fix: NrekiDB.getEngramsForFile migrated from string interpolation to parameterized prepared statement.
  • 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.
  • Path traversal guard in CLI enforcer hook generated by getEnforcerScriptContent(); resolved paths must stay inside cwd.
  • Auto-patch of legacy enforcer hook on boot: existing installations missing the traversal guard are rewritten with the hardened script before server.connect().
  • set_plan stores relative POSIX path in nreki_master_plan metadata instead of absolute path.

Correctness

  • Guillotine de payload es ahora incondicional en semantic-edit.ts (eliminados && !dryRun).
  • Recuperación de SQLite corrupto: NrekiDB._init() envuelve la carga en try/catch y recrea la BD si el buffer está dañado.
  • isError: true añadido a las 4 salidas tempranas de handlePin / handleUnpin.
  • 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).
  • Router facades (handleNavigate, handleCode, handleGuard) llaman await deps.engine.initialize() al inicio; handleGuard ahora incluye karma penalty.

Performance

  • Lazy-load del raw identifier index: NrekiDB.searchRawCode construye el índice en la primera llamada.

Cosmetic

  • computeTriageRisk: regex de ternario con lookaround (?<!\?)\?(?!\.|:|\?) evita inflar el conteo de ramas con ?. u ??.

Tests

  • 729/729 pasan (45 archivos, ~140s).

v10.2.0 — Triage v2: SAST radar

Choose a tag to compare

@Ruso-0 Ruso-0 released this 14 Apr 22:58

Triage v2 — SAST radar with cleanCode pre-pass

computeTriageRisk now pre-strips comments, strings, and template literals before any regex analysis, eliminating false positives from keywords buried inside literals. Adds three new risk signals tuned for trading/finance codebases.

New signals

  • cleanCode pre-pass — strips /* */, //…, and string/template literals before analysis
  • Domain keywords (+2)pnl, price, volume, amount, balance, margin, risk, vwap, liquidation, drawdown, position, order, fill, iceberg, trade
  • Math ops (+1/+2) — arithmetic detection with negative lookahead (ignores +=, ++, --)
  • Type gap (+2)as any / : any
  • Biz-logic adds match keyword

Retuning

  • Mutations >0 → +1 ("mutates state") — was previously only scored when >2
  • MED threshold 3 (was 2) — reduces over-triage on medium functions

Kept intact

  • Outline guillotine (LOW symbols collapsed into name-only list)
  • Proactive top-3 HIGH auto-expansion

Verification

  • 729/729 tests passing
  • tsc clean

Generated with Claude Code & Jherson Eddie Tintaya Holguin