How youuujiiin/scope-narrative-consistency-analysis-system works
Glitch is a web application for detecting continuity problems in long-form narratives. Its main workflow is to submit a chapter, extract structured canon data, let the user confirm that data, then review it against the established canon and surface contradictions. The backend separates API, services, pipeline adapters, and persistence; analysis work can run through worker tasks. The AI server provides the analysis side of the pipeline, including extraction, review, entity resolution, and embeddings. The README is empty, and several routes and AI modules were not sampled, so uncertain connections are left out or marked unverified.
Main entry points: main.py API application · workflow.py Analysis workflow · repository Domain repositories · pipeline Pipeline adapters
Components 23
Web client
- Web interface
frontend/script.js
Application backend
- API application
app/main.py - Chapter routes
app/api/chapters.py - Pipeline health route
app/api/pipeline.py - Chapter workflow
app/service/chapter_service.py - Pipeline health check
app/service/pipeline_service.py - Analysis tasks
app/workers/tasks.py - Background worker
app/workers/worker.py
Narrative analysis
- Analysis contract
app/pipeline/interface.py - Pipeline adapters
app/pipeline - AI service
ai_server/server/main.py - Scope bridge
ai_server/server/scope_bridge.py - Analysis workflow
ai_server/scope_ai/workflow.py - Entity resolution
ai_server/scope_ai/id_split - Event embeddings
ai_server/scope_ai/embedding - Contradiction review
ai_server/scope_ai/review/reviewer.py
Persistence
- Domain repositories
app/repository - Application database
app/core/db.py
Account and collaboration
- Authentication
app/service/auth_service.py - Chat assistant
app/chat/assistant.py - Sharing service
app/service/share_service.py - Notifications
app/service/notification_service.py
Other components
- Writer
Connections 22
- Writer → Web interface: uses
- API application → Chapter routes: registers
app/main.py - API application → Pipeline health route: registers
app/main.py - Pipeline health route → Pipeline health check: checks health
app/api/pipeline.py - Pipeline health check → Pipeline adapters: selects adapter
app/service/pipeline_service.py - Pipeline adapters → Analysis contract: implements
app/pipeline/factory.py - Chapter workflow → Analysis contract: calls analysis
app/service/chapter_service.py - Chapter workflow → Domain repositories: reads and writes
app/service/chapter_service.py - Analysis tasks → Analysis contract: calls extraction and review
app/workers/tasks.py - Analysis tasks → Domain repositories: records results
app/workers/tasks.py - Background worker → Analysis tasks: runs tasks
app/workers/worker.py - Pipeline adapters → AI service: calls remotely
- AI service → Scope bridge: dispatches
ai_server/server/main.py - Scope bridge → Analysis workflow: hands off analysis
- Analysis workflow → Entity resolution: uses identifiers
- Analysis workflow → Event embeddings: uses embeddings
- Analysis workflow → Contradiction review: performs review
- Domain repositories → Application database: persists domain data
- Authentication → Domain repositories: uses account storage
app/service/auth_service.py - API application → Chat assistant: conditionally registers
app/main.py - API application → Sharing service: conditionally registers
app/main.py - API application → Notifications: conditionally registers
app/main.py