Repository navigation
Closed
Labels
featNew featureneeds discussionRequires team discussion before implementationpriority: lowLow priorityservice: platformPlatform serviceservice: ragRAG service
Description
Background
The rag_write_tool was temporarily removed because knowledge entries written through conversations were directly sent to the external RAG service without being recorded in Convex database. This made it impossible to manage (view, edit, delete) these entries through the existing document management UI.
Problem
When the rag_write_tool was active:
- Users could add new knowledge or corrections via chat conversations
- These entries were directly POST'd to the RAG service (
/api/v1/documents) - Document IDs were generated with pattern:
{type}-{timestamp}-{randomString} - No record was kept in Convex, so entries couldn't be managed later
- This could lead to confusion and uncontrollable knowledge accumulation
Knowledge Conflict Problem
A critical issue with the previous implementation: new knowledge could conflict with existing knowledge without resolution.
Example Scenario
- Knowledge base contains: "Return policy is 7 days"
- User says via chat: "Update return policy to 3 days"
rag_write_tooladds a new document with "Return policy is 3 days"- Both documents now exist in the RAG service
- Future queries may retrieve either or both, causing inconsistent responses
Why the "Correction" Mechanism Failed
The tool attempted to handle this by creating correction documents:
CORRECTION - RETURN POLICY
Previous (INCORRECT) information: 7-day return policy
CORRECT information: 3-day return policy
Note: The correct information above should be used instead of older information.
Problems:
- Old document still exists and can be retrieved
- LLM must interpret the "correction note" - no guarantee it will
- Correction may not rank higher than original in similarity search
- Multiple corrections on same topic accumulate over time
Proposed Solution
If we want to re-enable this feature, we need to address both the management and conflict issues:
1. Database Schema
- Create a
knowledge_entriestable in Convex - Fields:
organizationId,topic,content,type,ragDocumentId,createdAt,createdBy - Index by
topicfor conflict detection
2. Conflict Resolution Strategy (Choose One)
- Option A: Delete + Replace - When adding knowledge on an existing topic, delete the old entry first
- Option B: Versioning - Track versions by topic, RAG service only surfaces latest version
- Option C: Approval Workflow - Chat-submitted knowledge goes to admin queue for review before indexing
- Option D: Manual Only - Only allow knowledge modifications via admin UI, not via chat (current state)
3. Modify rag_write_tool
- After writing to RAG service, create record in
knowledge_entriestable - Store
ragDocumentIdfor future deletion capability - Implement chosen conflict resolution strategy
4. Management UI
- Add section in Knowledge management area (alongside Documents)
- List all user-contributed knowledge entries grouped by topic
- Show version history if versioning is implemented
- Allow viewing, editing, and deletion
5. Backend APIs
getKnowledgeEntries: List entries with paginationdeleteKnowledgeEntry: Delete from both Convex and RAG servicegetKnowledgeByTopic: For conflict detection
Related Files
- Removed:
services/platform/convex/agent_tools/rag/rag_write_tool.ts - Registry:
services/platform/convex/agent_tools/tool_registry.ts - Chat agent:
services/platform/convex/lib/create_chat_agent.ts - Existing document management:
services/platform/app/(app)/dashboard/[id]/(knowledge)/documents/
Open Questions
- Which conflict resolution strategy should we adopt?
- Should entries be organization-scoped or support cross-org knowledge?
- Should there be rate limiting to prevent abuse?
- How to handle semantic duplicates (same meaning, different wording)?
This issue is for discussion and tracking. Implementation can proceed once the approach is agreed upon.
Metadata
Metadata
Assignees
Labels
featNew featureneeds discussionRequires team discussion before implementationpriority: lowLow priorityservice: platformPlatform serviceservice: ragRAG service
Activity
larryro commentedon Jan 2, 2026
Related Commit
The
rag_write_toolhas been removed in commit0d441c6:Changes:
services/platform/convex/agent_tools/rag/rag_write_tool.tstool_registry.ts)create_chat_agent.ts)chat-interface.tsx)en.json)The feature is now disabled until a proper management solution (as discussed in this issue) is implemented.
larryro commentedon Jan 12, 2026
Discussion: Alternative Approach
One consideration: Do we really need the
rag_write_toolfeature?Alternative: Use Existing Documents Page
Instead of implementing the full solution (new table + conflict resolution + management UI), users could simply:
Pros of This Approach
Cons
Potential Middle Ground
If conversational knowledge capture is still desired, consider a lighter approach: have the AI suggest that users upload information to the Documents page, rather than auto-writing to the RAG service.
This is just a thought for discussion, not a final decision. Open to other perspectives.
yannickmonney commentedon Apr 7, 2026
This requires both RAG service changes (CRUD endpoints for knowledge entries) and platform UI (management interface). The knowledge entries need to be tracked in Convex for the management UI while being synced to the RAG service for search.
yannickmonney commentedon May 31, 2026
Triaged — keeping open as a design/feature item. Confirmed the
rag_write_toolwas removed and isn't in the tool registry. Re-enabling conversational knowledge writes needs a conflict-resolution strategy and a management UI — and there's a zero-dev alternative on the table (just use the Documents page) that has support. Decision pending; assigned to me. Related: #662, #77.