How rfranr/memory-cli works
RAG-CLI is a local command-line tool for syncing a category taxonomy, classifying and indexing text/files/URLs, and searching or filtering indexed chunks. The main workflow is taxonomy sync followed by document input, chunking, embedding and category matching, then persistence; search embeds a query and retrieves nearest chunks. The core application wires use cases to SQLite stores and an HTTP embedding service. Several use-case and adapter details are represented from README and source-index references rather than inspected excerpts.
Main entry points: core.ts App composition · index-document.ts Index documents · http-embedding-client.ts HTTP embeddings · sqlite-category-store.ts Category SQLite store
Components 20
CLI and composition
- Command interface
src/cli/program.ts - App composition
src/core/core.ts - Runtime config
src/config/config.ts
Document workflows
- Classify documents
src/application/classify-document.ts - Index documents
src/application/index-document.ts - Sync taxonomy
src/application/taxonomy-sync.ts - Semantic search
src/application/search-documents.ts - Filtered find
src/application/find-documents.ts - Database stats
src/application/stats.ts - Domain contracts
src/domain/ports.ts - Input reader
src/application/classify-document.ts
Infrastructure adapters
- YAML taxonomy loader
src/infrastructure/taxonomy/yaml-taxonomy-loader.ts - HTTP embeddings
src/infrastructure/embedding/http-embedding-client.ts - Category SQLite store
src/infrastructure/database/sqlite-category-store.ts - Document vector store
src/infrastructure/database/sqlite-vector-store.ts
Shared runtime
- Text chunking
src/shared/chunk-text.ts - Progress reporting
src/shared/progress.ts - Index metadata
src/shared/index-metadata.ts
Other components
- CLI user
- Embedding endpoint
Connections 34
- CLI user → Command interface: runs commands
README.md - Command interface → App composition: creates app
src/cli/program.ts - App composition → Runtime config: builds config
src/core/core.ts - App composition → Classify documents: dispatches classify
src/core/core.ts - App composition → Index documents: dispatches index
src/core/core.ts - App composition → Sync taxonomy: dispatches sync
src/core/core.ts - App composition → Semantic search: dispatches search
src/core/core.ts - App composition → Filtered find: dispatches find
src/core/core.ts - App composition → Database stats: dispatches stats
src/core/core.ts - Classify documents → Input reader: reads input
src/application/classify-document.ts - Index documents → Input reader: reads input
src/application/index-document.ts - Index documents → Text chunking: chunks text
src/application/index-document.ts - Index documents → HTTP embeddings: embeds chunks
- Index documents → Category SQLite store: matches categories
- Index documents → Document vector store: stores chunks
- Classify documents → HTTP embeddings: embeds input
- Classify documents → Category SQLite store: searches categories
- Sync taxonomy → YAML taxonomy loader: loads YAML
src/application/taxonomy-sync.ts - Sync taxonomy → HTTP embeddings: embeds categories
- Sync taxonomy → Category SQLite store: upserts categories
- Semantic search → HTTP embeddings: embeds query
README.md - Semantic search → Document vector store: searches vectors
README.md - Filtered find → Document vector store: filters chunks
README.md - Database stats → Document vector store: reads document stats
- Database stats → Category SQLite store: reads category stats
- App composition → Document vector store: initializes stores
src/core/core.ts - App composition → Category SQLite store: initializes stores
src/core/core.ts - App composition → HTTP embeddings: constructs client
src/core/core.ts - HTTP embeddings → Embedding endpoint: POSTs input
src/infrastructure/embedding/http-embedding-client.ts - Index documents → Progress reporting: reports progress
src/application/index-document.ts - App composition → Index metadata: validates store metadata
- Domain contracts → Category SQLite store: defines contract
src/infrastructure/database/sqlite-category-store.ts - Domain contracts → Document vector store: defines contract
src/infrastructure/database/sqlite-vector-store.ts - Domain contracts → HTTP embeddings: defines contract
src/infrastructure/embedding/http-embedding-client.ts