How atandritc/clearance works
Clearance is a permission-aware company knowledge assistant. Employees sign in or use demo identities, ask a question, and receive an answer grounded in authorized document passages and permitted HR/IT tool results; unsupported answers abstain. A separate indexing workflow parses versioned Markdown, chunks and embeds it, and stores metadata and searchable vectors. The graph also preserves admin grant controls and evaluation as documented product capabilities. Runtime relationships follow the excerpts and README; some indexing and integration links are documented rather than verified in sampled implementation.
Main entry points: search.py Authorized search · main.py FastAPI · graph.py Assistant graph · index_knowledge_base.py Index builder
Components 21
Web client
- Web app
frontend/src/App.jsx
Identity and access
- FastAPI
src/clearance/main.py - Auth and users
src/clearance/auth.py - Access grants
src/clearance/retrieval/grants.py - PostgreSQL
- Domain records
src/clearance/models.py
Knowledge indexing
- Markdown parser
src/clearance/ingestion/markdown.py - Chunking
src/clearance/ingestion/chunking.py - Index builder
scripts/index_knowledge_base.py - Metadata import
scripts/import_knowledge_metadata.py - Embeddings
src/clearance/embeddings.py - Qdrant
Retrieval and answers
- Authorized search
src/clearance/retrieval/search.py - Access filters
src/clearance/retrieval/filters.py - Assistant graph
src/clearance/assistant/graph.py - Answer validation
src/clearance/assistant/answer.py - Groq client
src/clearance/llm/client.py
Employee tools and evaluation
- HR and IT tools
src/clearance/tools/mcp_server.py - Evaluation runner
src/clearance/evaluation/runner.py
Other components
- Employee
- Groq
Connections 27
- Employee → Web app: asks
- Web app → FastAPI: requests
- FastAPI → Auth and users: authenticates
src/clearance/main.py - FastAPI → Authorized search: searches
src/clearance/main.py - FastAPI → Assistant graph: answers via
- FastAPI → Access grants: manages grants
src/clearance/main.py - Auth and users → PostgreSQL: reads users
- Access grants → PostgreSQL: reads grants
- FastAPI → PostgreSQL: uses session
src/clearance/main.py - Metadata import → Markdown parser: parses documents
scripts/import_knowledge_metadata.py - Metadata import → PostgreSQL: stores metadata
- Index builder → Markdown parser: parses corpus
scripts/index_knowledge_base.py - Index builder → Chunking: creates chunks
scripts/index_knowledge_base.py - Index builder → Embeddings: embeds chunks
scripts/index_knowledge_base.py - Index builder → Qdrant: stores vectors
- Authorized search → Embeddings: embeds query
src/clearance/retrieval/search.py - Authorized search → Access grants: loads grants
src/clearance/retrieval/search.py - Authorized search → Access filters: builds filter
src/clearance/retrieval/search.py - Authorized search → Qdrant: queries
src/clearance/retrieval/search.py - Assistant graph → Authorized search: retrieves evidence
src/clearance/assistant/graph.py - Assistant graph → HR and IT tools: calls tools
src/clearance/assistant/graph.py - Assistant graph → Groq client: generates response
src/clearance/assistant/graph.py - Assistant graph → Answer validation: validates result
src/clearance/assistant/graph.py - Groq client → Groq: requests completion
src/clearance/llm/client.py - HR and IT tools → PostgreSQL: reads and writes
- Evaluation runner → Authorized search: evaluates retrieval
scripts/run_evaluation.py - Evaluation runner → Answer validation: evaluates answers
scripts/run_evaluation.py