How haoxuanzheng/pi works
LifeGraph is a private-by-default personal knowledge system: users capture and organize versioned objects, connect and authorize them, then use retrieval and AI assistance or deliberately publish projections. The map follows the API/UI into domain services and PostgreSQL-backed repositories, with separate branches for imports, files, identity, and account operations. Evidence is strongest for the sampled object, Ask, publication, permissions, retrieval, and storage paths; other documented capabilities are included without guessing at unsampled internal call chains.
Main entry points: objects.ts Objects and revisions · schema.ts PostgreSQL schema · retrieval.ts Hybrid retrieval · app Web application
Components 25
Web experience
- Web application
apps/web/app - Object API
apps/web/app/api/v1/objects/route.ts - Library editor
apps/web/app/library/[objectId]/ObjectEditor.tsx - Ask API
apps/web/app/api/v1/ask/route.ts - Publication API
apps/web/app/api/v1/publications/route.ts
Knowledge core
- Objects and revisions
packages/db/src/repositories/objects.ts - Permission engine
packages/db/src/repositories/permissions.ts - Capability decisions
packages/permissions/src/index.ts - Object relationships
packages/db/src/repositories/relationships.ts - Public projections
packages/db/src/repositories/publications.ts - PostgreSQL schema
packages/db/src/schema.ts
AI and retrieval
- Evidence-grounded answers
packages/ask/src/index.ts - AI proposals
packages/ai/src/index.ts - Hybrid retrieval
packages/db/src/repositories/retrieval.ts - Chunking and budgets
packages/retrieval/src/index.ts
Capture and integrations
- Import API
apps/web/app/api/v1/imports/start/route.ts - Provider importers
packages/imports/src/google-drive.ts - Person resolution
packages/entities/src/index.ts - File API
apps/web/app/api/v1/files/upload-intent/route.ts - File storage adapters
packages/storage/src/index.ts
Identity and account
- Authentication
packages/auth/src/index.ts - Provider connections
packages/connections/src/index.ts - Account export and deletion
packages/privacy/src/index.ts - Onboarding and analytics
packages/analytics/src/index.ts
Other components
- User
Connections 35
- User → Web application: uses
- Web application → Object API: creates objects
apps/web/app/api/v1/objects/route.ts - Object API → Objects and revisions: creates and lists
apps/web/app/api/v1/objects/route.ts - Library editor → Objects and revisions: edits revisions
- Objects and revisions → Permission engine: checks access
packages/db/src/repositories/objects.ts - Permission engine → Capability decisions: decides capabilities
packages/db/src/repositories/permissions.ts - Objects and revisions → PostgreSQL schema: persists snapshots
packages/db/src/repositories/objects.ts - Permission engine → PostgreSQL schema: reads and writes grants
packages/db/src/repositories/permissions.ts - Object relationships → Permission engine: authorizes endpoints
- Object relationships → PostgreSQL schema: stores relationships
packages/db/src/schema.ts - User → Ask API: asks questions
- Ask API → Evidence-grounded answers: classifies and answers
apps/web/app/api/v1/ask/route.ts - Ask API → Hybrid retrieval: searches evidence
apps/web/app/api/v1/ask/route.ts - Ask API → Objects and revisions: loads result metadata
apps/web/app/api/v1/ask/route.ts - Evidence-grounded answers → AI proposals: uses AI provider
packages/ask/src/index.ts - Evidence-grounded answers → Chunking and budgets: uses retrieval types
packages/ask/src/index.ts - Hybrid retrieval → Chunking and budgets: chunks and budgets
packages/db/src/repositories/retrieval.ts - Hybrid retrieval → Objects and revisions: loads objects
packages/db/src/repositories/retrieval.ts - Hybrid retrieval → Permission engine: checks indexing access
packages/db/src/repositories/retrieval.ts - Hybrid retrieval → PostgreSQL schema: stores embeddings
packages/db/src/repositories/retrieval.ts - User → Publication API: publishes selected views
- Publication API → Public projections: creates projections
apps/web/app/api/v1/publications/route.ts - Public projections → PostgreSQL schema: stores projections
packages/db/src/schema.ts - Web application → Import API: starts imports
- Import API → Provider importers: dispatches provider import
apps/web/app/api/v1/imports/start/route.ts - Provider importers → Objects and revisions: creates private objects
- Provider importers → Person resolution: resolves people
- Web application → File API: uploads attachments
- File API → File storage adapters: requests file storage
- File storage adapters → PostgreSQL schema: records file metadata
- User → Authentication: signs in
- Authentication → Web application: provides authenticated access
apps/web/app/auth/confirm/route.ts - User → Provider connections: connects providers
- User → Account export and deletion: exports or deletes account
- User → Onboarding and analytics: completes onboarding