Skip to content

Let AI chats search and read notes - #45

Merged
lobbystack merged 3 commits into
mainfrom
feature/chat-note-tools
Nov 30, 2026
Merged

lobbystack merged 3 commits into
mainfrom
feature/chat-note-tools

Conversation

@lobbystack

@lobbystack lobbystack commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

A plain chat could call only the plugins' tools, Tasks and Projects. Reading notes was a kernel tool, noura__read, that only Orb runs got: workspace-tools returned plugin tools alone, and pending_calls refused a noura__ call in any run without an Orb. You couldn't ask a chat "what did we decide in Thursday's review?"

What changed

Every chat now offers three note tools beside the plugins' tools:

  • noura__search_notes searches titles and text through the existing search index.
  • noura__list_notes lists the folders and Markdown files directly in one folder.
  • noura__read reads a Markdown file by title, link or path and returns its title, path, properties and body.

They live in crates/app-core/src/ai/notes.rs. Orbs now get the same three from there, so Orbs gain search and list, and an Orb's reads limit what all three show it. noura__read keeps its link argument for Orb files that already list it.

The tools only read. Each one's target sets the read_only flag that #43 added, so a call runs without the prompt, with Ask before the AI changes your workspace on or off. I added no note-writing tools to chats: the MCP server has notes.create and notes.update, but Orbs have no note-writing kernel tool, so nothing existing fit.

The AI page shows the calls as Searched notes, Listed notes and Read a note. The chat instructions now call tool results, such as notes, untrusted data.

Limits

  • Search returns 10 hits by default and 20 at most, with more: true when it left some out.
  • A listing returns up to 200 entries, with more.
  • A read gives up to 40,000 characters of the body. A longer body ends with [Noura cut the rest.], and truncated is true.
  • Paths go through local-core's checks, so .., absolute paths, reserved folders such as .noura and symlinks fail.
  • A new WorkspaceEngine::is_visible_file keeps out dot files, node_modules and target, and anything the Ignored files list matches. Search and read both apply it.
  • Search and listings leave out chats. Without that, a search found the chat's own question first.
  • Only Markdown files are read.

The TypeScript kit's mock host offers the same three tools after a plugin's own, as the real host does.

Docs

The WIT comments on workspace-tools and run-tools, the frozen 0.1.0 copy, the generated reference, docs/plugins/interfaces/ai.md, docs/architecture/ai-runtime.md (a new Note tools section) and the Orb tool list in docs/workspace-format/v1.md cover the tools. The ai interface page and the runtime notes also still said every call asks, so they now describe #43's read-only rule.

Tests

  • local-core: is_visible_file for ignored, reserved, dotted and unsafe paths.
  • app-core ai_notes: a chat offers the tools, searches and then reads a note with no prompt, and the answer shows on the page. Search finds a note by its text and leaves out ignored files and the chat itself. It caps hits at 20. Read works by link or path and refuses traversal, absolute and reserved paths, ignored files, PDFs and symlink escapes. A long note comes back cut. The listing leaves out ignored folders and chats.
  • app-core orb_runs: an Orb's search and listing stay inside its reads.
  • TypeScript kit: same-results checks that both hosts list the note tools and that the mock host's names, descriptions and schemas match the real host's.
  • app-ui: an egui_kittest test where a fake streamer searches, reads the hit by its path and answers from the note. No prompt appears, and both rows show Done.

npm run check and the kit's tests pass against the real host. cargo fmt, cargo clippy --workspace --all-targets --all-features -- -D warnings, and the full local-core, app-core, app-ui, plugin-host, plugin-sdk, ai-plugin and noura-mcp suites pass with NOURA_REQUIRE_PLUGINS=1. I rebased onto main after #43 merged and reran clippy and the local-core, app-core AI and Orb, app-ui and plugin-host tests.

WorkspaceEngine::is_visible_file checks a workspace path the way the
index and the file tree do. It fails for a path that leaves the
workspace or names a reserved folder. It returns false for dot files and
dot folders, node_modules and target at the top, and anything the
Ignored files list matches, including through a parent folder.

The AI note tools use it to keep ignored files away from the model.
A plain chat offered only the plugins' tools, Tasks and Projects, so the
AI couldn't answer from your notes. Noura's own tools reached only Orb
runs. workspace-tools listed plugin tools alone, and run-tools refused a
noura__ call in any run without an Orb.

Every chat now offers three note tools beside the plugins' tools:

- noura__search_notes searches titles and text through the search
  index. It returns 10 hits by default and 20 at most, with more: true
  when it left some out.
- noura__list_notes lists the folders and Markdown files directly in one
  folder, up to 200 entries.
- noura__read reads a Markdown file by title, link or path. A body over
  40,000 characters ends with "[Noura cut the rest.]" and truncated:
  true.

They only read. Their targets set the read_only flag that #43 added for
a plugin's read-only tools, so their calls run without the prompt
whether or not Ask before the AI changes your workspace is on. The
tools write nothing, so there are no note-writing tools for chats.

app-core's ai/notes.rs holds the tools, and Orbs now get them from the
same place. noura__read keeps its link argument for Orb files that list
it, and search and list respect an Orb's reads. local-core checks every
path, so traversal, absolute paths, reserved folders and symlinks fail.
The tools leave out dot files and ignored files, and search and listings
leave out chats, so a chat doesn't find its own question. Noura's chat
instructions now call tool results untrusted data.

The AI page names the rows Searched notes, Listed notes and Read a note.
The WIT comments on workspace-tools and run-tools, the frozen copy, the
reference, the ai interface page, the runtime notes and the Orb format
list the tools. The ai interface page and the runtime notes also now
say that read-only calls skip the prompt, as #43 made them.

Tests: an app-core chat offers the tools, finds a note by its text,
leaves out ignored files and its own chat, caps hits at 20, reads by
link or path, refuses traversal, absolute and reserved paths, ignored
files and symlink escapes, and cuts a long note. An Orb's search stays
inside its reads. An egui_kittest test has a fake model search, read
and answer from the note, with no prompt and both rows Done.
The real host's workspaceTools now ends with noura__search_notes,
noura__list_notes and noura__read, so the kit's same-results test failed
on the mock host, which offered only the plugin's own tools. The mock
host now offers the same three after the plugin's tools.

The probe plugin's ai-note-tools call returns the note tools' full
definitions. The same-results test checks that the real host returns
the same names, descriptions and schemas as the mock host, so the
mock's copy can't drift from app-core's. The ai interface page says what
the mock host's workspaceTools returns.
@lobbystack
lobbystack merged commit a2e67ad into main Nov 30, 2026
78 of 80 checks passed
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