nextcloud / nextcloud/context_chat

Allow-list tag to restrict which documents get indexed by Context Chat

Open
#278 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
29
Forks
12
Avg merge
4d 4h
Merged PRs (30d)
5

Description

Describe the feature you'd like to request

Context Chat currently indexes documents based only on mimetype (a fixed whitelist), with no way to exclude specific files or folders from being embedded. For organizations handling sensitive or confidential documents, there's no mechanism to control which content gets sent to an LLM for embedding — everything matching the mimetype whitelist gets indexed by default. This is a real concern for compliance-sensitive environments where certain documents should never be processed by an AI model.

Describe the solution you'd like

I'm proposing an allow-list approach: a system tag (e.g. "AI knowledge") that a user or admin applies to a file or folder to mark it as eligible for indexing. Only tagged content would be embedded, instead of everything matching the mimetype whitelist by default.

I believe an allow-list approach ("only tagged content is indexed") makes more sense than a block-list ("everything except tagged content is indexed"), since it would be the safer default configuration. In other words, nothing is exposed unless someone explicitly marks it as "safe."

Thinking about cases where users already have Context Chat active with all documents already indexed, here's the solution I had in mind: add an option under Administration settings → Assistant → Context Chat, letting the admin choose between continuing to index all documents, or indexing only tagged documents. By default, this option should be set to "continue indexing all documents," so the new feature doesn't negatively affect any already-active user.

If the "index only tagged" option is selected instead, it should exclude already-indexed documents that don't have the tag.

Describe alternatives you've considered

I didn't consider a fundamentally different approach before landing on the tag-based solution — Nextcloud already has a system tag mechanism, and the codebase already follows an event-listener pattern for similar cases (FileListener.php), so extending that with TagAssignedEvent/TagUnassignedEvent felt like the natural fit rather than something requiring a separate design.

Image Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading FileListener.php and the existing Context Chat indexing and Administration → Assistant settings code. Investigate how TagAssignedEvent and TagUnassignedEvent could affect indexing, including already-indexed files. Done should include an admin choice between indexing all documents and only tagged documents, with untagged indexed documents excluded in the latter mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
ai, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.