Skip to content

Keep agents in their project's notes wherever the knowledge base points - #246

Merged
BunsDev merged 2 commits into
mainfrom
notes-review-fixes
Oct 15, 2026
Merged

BunsDev merged 2 commits into
mainfrom
notes-review-fixes

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Follow-ups from a /code-review high pass over the notes stack (#222, #226, #227 with #230/#238). The repair PRs (#235, #237, #238) addressed other findings. These ten were still open on main after #227.

Knowledge isolation (the most serious finding)

  • Before: knowledge tools were confined to one project only when the knowledge base was exactly the notes root.
    • A base set to ~/.modex/notes/Personal (a workspace) or ~/.modex let every project's agents read and write every other project's notes.
    • A .ok/config.yml content.dir broke the prefix: search threw ENOENT, and writes landed in the wrong place.
  • Now: every tool path is resolved to a real path first. If it lands in the notes folder, it must land in the project's own notes, so it works whatever the base is: the notes root, a workspace, a parent folder, a content.dir, or another project's folder (which then refuses everything).
  • Search: over such a base it's read locally, skipping other projects' notes. It's now async with fs.promises, so the main process keeps answering, and it's bounded to 20 results, 20,000 entries and 64 MB.

Following a move mid-turn

  • Pages and knowledge tools now look up the project's notes on every call. The Pages scope keeps the notes project's id and finds its current folder.
  • Before, a Move to during a turn made every search, read, edit and list fail with "outside this project's notes".

Read-only turns and unknown projects

  • The scope callbacks get create. Only a turn that may write calls linkProject; a read-only turn uses projectFor and refuses with "this project has no notes yet" instead of creating folders.
  • An unknown project now gets no notes (null). Before, undefined meant unscoped.

NotesStore

  • Copied folders: a workspace or project folder copied in Finder no longer makes the notes unreadable ("The default project identity is duplicated"). The default project's recorded place keeps the id, or else the first in sorted order. The copy gets a fresh id and no Modex link.
  • detachProject: it drops the cached look, so a removed project unlinks on the very next read, not after a watcher event or 10 seconds.
  • linkProject: it answers from the last look when the project is already linked. Before, it did a fresh walk, and it runs at the start of every agent turn and once per project at open.
  • Watcher: it ignores dot folders (.modex, Open Knowledge's .ok, .git) but not workspace or project markers. Before, every Open Knowledge write made Space re-walk the whole folder. The filter is now watchedChange(), tested directly.
  • pageRels(): it returns every page's place from one look. Pages search and list use it, and a page map built once per call, instead of a full read per page.

Sidebar: a workspace whose projects are all hidden by a search or the active-only filter no longer shows an empty header.

Tests

  • Knowledge:
    • a base set to a workspace, to a parent of the notes, to another project's folder, or to an unrelated folder (not fenced);
    • following a moved project;
    • a project with no notes;
    • the existing link-replacement case on the new fence.
  • Pages: a mid-turn move to another workspace (search, read, create, then read and list what was created), and a read-only turn that makes no notes.
  • Store: copied default and linked project folders, plus a watched store that detaches at once and links without walking.
  • Watcher filter: watchedChange() cases.
  • Existing watch test: its fake clock now outruns the 10-second re-look. That makes it deterministic when macOS delivers file events late, which this Mac did under load average ~85.
  • Result: the full unit suite passes, and the typecheck is clean.

Docs: docs/status.md and docs/notes.md (copied folders).

Follow-ups from a code review of the notes stack (#222, #226, #227, #230).

Knowledge tools fence by real paths: a document path that lands in the notes
folder must land in the turn's own project, whether the knowledge base is the
notes folder, a workspace inside it, a folder that holds it, or a content.dir
inside it. Search over such a base is read locally, asynchronously and
bounded, skipping other projects' notes. Before, only a base that was exactly
the notes root was confined, and a content.dir broke the prefix.

Pages and knowledge tools look up the project's notes on every call, so
moving them to another workspace mid-turn no longer refuses every call. A
read-only turn finds the project's notes without making them, and an unknown
project gets none rather than every project's.

NotesStore: a copied workspace or project folder gets its own id instead of
making the store unreadable; detachProject drops the cached look;
linkProject answers from the last look when already linked; the watcher
ignores dot folders (.modex, .ok, .git) but not markers; pageRels() serves a
whole call. The sidebar hides a workspace whose projects a filter hides.

Coven-Harness: Claude Code / claude-opus-5-5
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 15, 2026 10:16pm UTC

Request Review

@github-code-quality

github-code-quality Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 6366cb5 notes-review-fixes 4556f86 +/-
60% 60% 0%
View coverage of the 3 most impacted files.
File main 6366cb5 notes-review-fixes 4556f86 +/-
apps/desktop/sr.../notes-store.ts 98% 98% 0%
apps/desktop/sr...pages-agents.ts 100% 100% 0%
apps/desktop/sr...ledge-agents.ts 94% 95% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 15, 2026 22:46 UTC

@BunsDev BunsDev self-assigned this Oct 15, 2026
@BunsDev
BunsDev merged commit e561c9c into main Oct 15, 2026
13 checks passed
@BunsDev
BunsDev deleted the notes-review-fixes branch October 15, 2026 23:18

This branch was successfully deployed

1 active deployment
Preview — 4556f86b Deployed Oct 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant