How pyrite-wiki/pyrite works
Pyrite is a knowledge-as-code system: people and AI agents create, validate, search, and manage typed knowledge entries stored as Markdown files in Git. The principal flow is a request through the CLI, REST API, MCP server, or Web UI to shared KB files; a derived SQLite index supports keyword and semantic search. The graph also preserves schema, plugin, task, and access-control capabilities. Internal call links are limited because most sampled excerpts are partial; documented shared-file and indexing relationships are shown from the README.
Main entry points: repository.py Markdown repository · mcp_server.py MCP server · search_service.py Search · plugins Plugin system
Components 23
User interfaces
- CLI
pyrite/cli - REST API
pyrite/server/api.py - MCP server
pyrite/server/mcp_server.py - Web UI
web/src/routes
Knowledge model
- KB configuration
pyrite/config.py - Schema validation
pyrite/schema - Typed entries
pyrite/models
Storage and search
- Markdown repository
pyrite/storage/repository.py - KB file safety
pyrite/utils/kb_files.py - Index manager
pyrite/storage/index.py - SQLite index
pyrite/storage/database.py
Domain services
- KB operations
pyrite/services/kb_service.py - Search
pyrite/services/search_service.py - Semantic embeddings
pyrite/services/embedding_service.py - Access policy
pyrite/services/access_policy.py - Task workflows
pyrite/services/task_service.py - Knowledge export
pyrite/services/export_service.py
Plugins and extensions
- Plugin system
pyrite/plugins - Investigation tools
extensions/journalism-investigation/src/pyrite_journalism_investigation - Software KB
extensions/software-kb/src/pyrite_software_kb
Other components
- Person
- AI agent
- Git repository
Connections 24
- Person → CLI: uses
- Person → Web UI: uses
- AI agent → MCP server: connects through
- CLI → Markdown repository: reads and writes
- REST API → Markdown repository: reads and writes
- MCP server → Markdown repository: reads and writes
- Web UI → REST API: uses
- Markdown repository → Git repository: versioned in
- Markdown repository → Index manager: indexes files
pyrite/storage/index.py - Index manager → SQLite index: updates index
pyrite/storage/index.py - Search → SQLite index: searches index
pyrite/services/search_service.py - Search → Semantic embeddings: semantic search
pyrite/services/search_service.py - KB operations → Markdown repository: writes entries
pyrite/services/kb_service.py - KB operations → Index manager: indexes entries
pyrite/services/kb_service.py - Markdown repository → KB file safety: guards file access
pyrite/utils/kb_files.py - Markdown repository → Typed entries: loads entries
pyrite/storage/repository.py - Typed entries → Schema validation: validates against
pyrite/schema/__init__.py - MCP server → Access policy: enforces tiers
- Plugin system → Schema validation: extends entry types
pyrite/plugins/context.py - Plugin system → MCP server: adds tools
- AI agent → Task workflows: manages tasks
- Investigation tools → Search: cross-KB search
extensions/journalism-investigation/src/pyrite_journalism_investigation/cross_kb_search.py - Software KB → Plugin system: extends Pyrite
- Person → Knowledge export: requests export