Agent read/ls tools fail with ENOENT when book-relative paths guess the "story/" prefix wrong (both directions)
What happened?
The agent-layer file tools (read, ls) intermittently return ENOENT because the LLM resolves
book-relative paths with the story/ segment wrong in either direction:
ls <book>/outline→ ENOENT (actual location:<book>/story/outline)ls <book>/story/_guide→ ENOENT (actual location:<book>/_guide; ingested reference material lives at the book root)
The deterministic pipeline (state manager / writer / runner) uses explicit paths and never hits this — only the agent exploration layer fails. Root cause: tool descriptions say only "path is relative to books/" with no layout manifest, and the resolver has no fallback for the common prefix confusion.
Related: the agent also probes chapters/.versions/index.json, which does not exist by design
(version archives are per-chapter dirs chapters/.versions/<NNNN>/). The tool description should
state this so the model stops inventing it.
Steps to reproduce
inkos init+ create a book (or open an existing project in Studio)- Let the agent inspect the outline or ingested guide material (any agent-driven flow that lists/reads book paths)
- Observe
Failed to list "<book>/outline": ENOENT ...orFailed to list "<book>/story/_guide": ENOENT ...although the target exists under the other convention
Expected behavior
The resolver should tolerate the story/-prefix confusion: when a requested path doesn't exist,
retry variants with the story segment removed / inserted after the book dir (logging the
reroute). Truly missing paths must still error. Tool descriptions should document the book
layout (story/ truth files, book-root ingested material, per-chapter .versions/ dirs, no global index).
InkOS version
1.8.0
Operating system
Windows (native)
LLM provider / model
provider-agnostic (agent layer); observed via OpenAI-compatible custom endpoint
Relevant logs
Failed to list "BOOK/outline": ENOENT: no such file or directory, scandir '...\books\BOOK\outline'
Failed to list "BOOK/story/_guide": ENOENT: no such file or directory, scandir '...\books\BOOK\story\_guide'
Failed to read "BOOK/chapters/.versions/index.json": ENOENT (file absent by design)Suggested patch (running in production locally, regression 4/4)
// agent-tools.js import { existsSync as __es } from 'node:fs'; function storyFix(p) { if (__es(p)) return p; const sep = p.includes('\') ? '\' : '/'; const parts = p.split(/[\/]/); const si = parts.indexOf('story'); let alt = null; if (si > 0) { const q = parts.slice(); q.splice(si, 1); alt = q.join(sep); } else { const bi = parts.lastIndexOf('books'); if (bi >= 0 && bi + 1 < parts.length) { const q = parts.slice(); q.splice(bi + 2, 0, 'story'); alt = q.join(sep); } } return alt && alt !== p && __es(alt) ? alt : p; } // createLsTool: const target = params.subdir ? storyFix(safeBooksPath(base, params.subdir)) : base; // resolveReadPath: return storyFix(safeChildPath(readRoot, requestedPath));
Source: Narcooo/inkos