[GH-ISSUE #4542] [Feature]: Give Professor Mari first-class documentation search #2477

Closed
opened 2026-10-21 05:48:34 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Aug 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4542

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Home-screen Professor Mari can technically inspect README.md and docs/ through her generic workspace read, grep, find, and ls tools. However, documentation is not a first-class knowledge source: it is not indexed or injected, there is no dedicated documentation search/read tool, and her system prompt does not tell her to prefer canonical user documentation before source code.

As a result, user-facing questions may cause Mari to broadly scan implementation files. This is slower and more context-expensive, can surface internal details instead of the supported user workflow, and makes it appear that she has no documentation access at all. Regular conversation-mode Mari also relies on a large baked-in knowledge prompt that can drift from the canonical docs.

Proposed solution

Add read-only, local documentation retrieval for Professor Mari:

  • Add a docs_search tool backed by canonical README.md and English docs/**/*.md. It should return ranked matches with the document path, heading, and a bounded excerpt.
  • Add a docs_read tool for reading a selected document or heading with bounded output.
  • Expose both tools through Professor Mari's native tool protocol and textual-tool fallback.
  • Update the workspace system prompt with a clear source policy:
    1. For user-facing questions about features, configuration, installation, or troubleshooting, consult canonical documentation first.
    2. Use built-in or CLI help for exact command syntax.
    3. Inspect source code only when the documentation is missing, ambiguous, or the user explicitly asks about internals.
    4. State when the answer required a code-level fallback.
  • Include source provenance in answers, at minimum the documentation path and heading used.
  • Keep retrieval local and read-only; no network access is required.
  • Verify that canonical English documentation is available to the tool in source, Docker, Windows, and Termux/install layouts.

Acceptance criteria:

  • A documented user-facing question causes Mari to use documentation retrieval before broad source-code search.
  • Results identify the source document and heading.
  • Missing documentation falls back to code inspection without blocking the answer, and Mari says that she used an implementation-level source.
  • Retrieval is bounded and does not inject the complete documentation corpus into every prompt.
  • Existing workspace filesystem and app-data safety boundaries remain unchanged.

Alternatives considered

  • Continue using generic workspace grep and read. This technically reaches the docs, but does not prioritize them or distinguish canonical guidance from implementation details.
  • Inject all documentation into every Professor Mari prompt. This would consume excessive context and make prompt assembly more expensive.
  • Expand the baked-in app-knowledge prompt. This duplicates documentation and can become stale whenever behavior or UI copy changes.
  • Add online web search. This is unnecessary for Marinara's own documentation and would weaken the current local-only security boundary.

Additional context

Current implementation references:

The current claim that Mari can search only code is technically incorrect in a source workspace, but accurately describes the product gap: documentation is merely another collection of files she must discover manually rather than a preferred, structured source.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Aug 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4542 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Home-screen Professor Mari can technically inspect `README.md` and `docs/` through her generic workspace `read`, `grep`, `find`, and `ls` tools. However, documentation is not a first-class knowledge source: it is not indexed or injected, there is no dedicated documentation search/read tool, and her system prompt does not tell her to prefer canonical user documentation before source code. As a result, user-facing questions may cause Mari to broadly scan implementation files. This is slower and more context-expensive, can surface internal details instead of the supported user workflow, and makes it appear that she has no documentation access at all. Regular conversation-mode Mari also relies on a large baked-in knowledge prompt that can drift from the canonical docs. ## Proposed solution Add read-only, local documentation retrieval for Professor Mari: - Add a `docs_search` tool backed by canonical `README.md` and English `docs/**/*.md`. It should return ranked matches with the document path, heading, and a bounded excerpt. - Add a `docs_read` tool for reading a selected document or heading with bounded output. - Expose both tools through Professor Mari's native tool protocol and textual-tool fallback. - Update the workspace system prompt with a clear source policy: 1. For user-facing questions about features, configuration, installation, or troubleshooting, consult canonical documentation first. 2. Use built-in or CLI help for exact command syntax. 3. Inspect source code only when the documentation is missing, ambiguous, or the user explicitly asks about internals. 4. State when the answer required a code-level fallback. - Include source provenance in answers, at minimum the documentation path and heading used. - Keep retrieval local and read-only; no network access is required. - Verify that canonical English documentation is available to the tool in source, Docker, Windows, and Termux/install layouts. Acceptance criteria: - A documented user-facing question causes Mari to use documentation retrieval before broad source-code search. - Results identify the source document and heading. - Missing documentation falls back to code inspection without blocking the answer, and Mari says that she used an implementation-level source. - Retrieval is bounded and does not inject the complete documentation corpus into every prompt. - Existing workspace filesystem and app-data safety boundaries remain unchanged. ## Alternatives considered - Continue using generic workspace `grep` and `read`. This technically reaches the docs, but does not prioritize them or distinguish canonical guidance from implementation details. - Inject all documentation into every Professor Mari prompt. This would consume excessive context and make prompt assembly more expensive. - Expand the baked-in app-knowledge prompt. This duplicates documentation and can become stale whenever behavior or UI copy changes. - Add online web search. This is unnecessary for Marinara's own documentation and would weaken the current local-only security boundary. ## Additional context Current implementation references: - [Professor Mari workspace tool registry](https://github.com/Pasta-Devs/Marinara-Engine/blob/staging/packages/server/src/services/professor-mari/workspace-agent.service.ts#L129-L220) - [Current generic workspace-files instruction](https://github.com/Pasta-Devs/Marinara-Engine/blob/staging/packages/server/src/services/professor-mari/workspace-agent.service.ts#L476-L477) - [Conversation-mode baked-in app knowledge](https://github.com/Pasta-Devs/Marinara-Engine/blob/staging/packages/server/src/db/seed-mari.ts#L71-L89) - [Canonical English documentation](https://github.com/Pasta-Devs/Marinara-Engine/tree/staging/docs) The current claim that Mari can search only code is technically incorrect in a source workspace, but accurately describes the product gap: documentation is merely another collection of files she must discover manually rather than a preferred, structured source. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [x] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:48:34 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 3, 2026):

Delivered to staging in #4543.

<!-- gh-comment-id:5172606065 --> @SpicyMarinara commented on GitHub (Aug 3, 2026): Delivered to staging in #4543.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2477
No description provided.