How prsense-labs/prsense works
PRSense is repository memory and code intelligence software: it detects overlapping pull requests, indexes code and engineering history for search and Q&A, and can generate unified refactors. Users enter through the CLI, GitHub Action, or server APIs; PR checks classify similarity, while RAG queries retrieve code, decisions, and PR history. The README also documents AST/health/style analysis, triage, impact scoring, rules, and automated refactor PRs. Some subsystem wiring is not shown in the sampled source, so uncertain connections are omitted.
Main entry points: server.ts HTTP Server · embeddingPipeline.ts Embedding Pipeline · interface.ts Storage Backends · index.ts GitHub Action
Components 32
Product Entry Points
- CLI
bin/prsense-easy.ts - GitHub Action
action/index.ts - HTTP Server
src/server.ts - RAG API
src/api/ragEndpoints.ts - Webhook Function
api/webhook.ts
Repository Memory
- Storage Backends
src/storage/interface.ts - File Storage
src/storage/file.ts - Postgres Storage
src/storage/postgres.ts - SQLite Storage
src/storage/sqlite.ts - Memory Storage
src/storage/memory.ts - Codebase Indexer
src/rag/codebaseIndexer.ts - RAG Query Engine
src/rag/queryEngine.ts
Code Intelligence
- PR Detector
src/prsense.ts - Similarity Decision
src/decisionEngine.ts - Embedding Pipeline
src/embeddingPipeline.ts - AST Parser
src/ast/parser.ts - Health Metrics
src/health/metrics.ts - Style Learner
src/style/learner.ts - PR Triage
src/triage.ts - Impact Scoring
src/impactScore.ts - Rules Engine
src/rules.ts
Refactoring
- Refactor Engine
src/refactor/engine.ts - Auto-PR Agent
src/refactor/auto-pr.ts
External Integrations
- Embedding Backends
src/embedders/onnx.ts - Git Providers
src/providers/index.ts - Slack Decision Ingest
src/providers/slackIngest.ts - Notification Dispatch
src/notifications/index.ts - LLM Providers
src/llm/deepseek.ts
Other components
- Developer / CI
- GitHub
- Slack
- Local Codebase
Connections 37
- Developer / CI → CLI: runs commands
- Developer / CI → GitHub Action: opens pull request
- Developer / CI → HTTP Server: calls APIs
- GitHub Action → PR Detector: checks PR
- GitHub Action → File Storage: loads and saves
- GitHub Action → Embedding Backends: selects backend
- PR Detector → Similarity Decision: classifies score
- PR Detector → Embedding Pipeline: embeds PR
- Embedding Pipeline → Embedding Backends: requests vectors
- HTTP Server → Git Providers: handles webhook via
- Webhook Function → HTTP Server: calls webhook handler
- HTTP Server → Postgres Storage: initializes when configured
- HTTP Server → SQLite Storage: initializes fallback
- HTTP Server → Memory Storage: uses fallback
- HTTP Server → PR Triage: classifies PR
- HTTP Server → Impact Scoring: scores impact
- HTTP Server → Rules Engine: evaluates rules
- HTTP Server → Notification Dispatch: dispatches notifications
- HTTP Server → Storage Backends: reads analytics
- RAG API → Storage Backends: obtains storage
- RAG API → Codebase Indexer: starts indexing
- RAG API → RAG Query Engine: runs query
- Codebase Indexer → Embedding Pipeline: embeds code chunks
- Codebase Indexer → Storage Backends: stores chunks
- RAG Query Engine → Embedding Pipeline: embeds question
- RAG Query Engine → Storage Backends: searches and hydrates
- RAG Query Engine → LLM Providers: synthesizes answer
- Slack → Slack Decision Ingest: submits decision
- Slack Decision Ingest → Embedding Pipeline: embeds decision
- Slack Decision Ingest → Storage Backends: saves decision
- Local Codebase → Codebase Indexer: provides files
- CLI → Refactor Engine: runs refactor
- Refactor Engine → LLM Providers: generates unified code
- Refactor Engine → Auto-PR Agent: requests auto PR
- Auto-PR Agent → GitHub: opens pull request
- GitHub → Git Providers: PR operations
- AST Parser → Health Metrics: supports analysis