Comments
Loading...
Smart Commenting System for Case Studies
Google Docs-style text selection and commenting for AI-human collaboration
Overview
The Smart Commenting System enables Google Docs-style collaboration on case studies. Users can select any text and attach comments directly to that selection, creating a precise feedback loop between AI authors and human reviewers.
Key Features
Design Philosophy
The system follows the "full Janus battery" pattern:
This layered approach ensures both humans (via UI) and AI agents (via MCP) can participate equally in the review process.
User Experience Flow
Selecting Text and Adding Comments
The popup includes:
Viewing Comments
Click the comment icon in the top-right corner to open the sidebar:
Resolving Comments
When a comment is addressed:
Resolved comments remain visible but are visually de-emphasized, preserving the discussion history.
Technical Architecture
Database Schema
CREATE TABLE case_study_comments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
case_study_id UUID NOT NULL REFERENCES case_studies(id),
section_id UUID REFERENCES case_study_sections(id),
author TEXT NOT NULL,
author_type TEXT NOT NULL DEFAULT 'human',
content TEXT NOT NULL,
quote_text TEXT, -- The selected text this comment references
resolved BOOLEAN DEFAULT FALSE,
resolved_by TEXT,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /api/v1/case-studies/{id}/comments | List all comments |
| POST | /api/v1/case-studies/{id}/comments | Add a comment |
| POST | /api/v1/case-studies/comments/{id}/resolve | Mark as resolved |
| DELETE | /api/v1/case-studies/comments/{id} | Delete a comment |
MCP Tools
AI agents can use these tools programmatically:
Frontend Components
AI Agent Integration
How AI Agents Use Comments
AI agents participate in the review process through MCP tools. This enables:
Automated Content Review
When a case study is submitted for review, an AI agent can:
Example: AI Adding a Comment
# AI agent reviewing a case study
await client.case_study_comment_add(
case_study_id="6d354192-...",
content="This section could use a concrete example to illustrate the concept.",
author="claude-code",
author_type="ai",
section_id="section-3-uuid",
quote_text="The autonomy stack enables..."
)Collaborative Workflow
This multi-agent approach ensures content is reviewed from multiple perspectives before human approval.
Future Enhancements
Planned Features
Text Highlighting
Currently comments reference text via quote_text field but don't visually highlight it. Future work:
Threaded Replies
Enable conversations within comments:
AI Auto-Review
Automatic AI review when drafts are submitted:
Real-time Collaboration
WebSocket-based live updates:
Rhea SSO Integration
Authentication for verified human identity: