Establish the full src/context_library/ package hierarchy with all sub-packages and placeholder module files, mirrored by a parallel tests/ directory structure.
Requirements
- Create
src/context_library/ as the root Python package with __init__.py
- Create the following sub-packages, each with an
__init__.py:
src/context_library/core/
src/context_library/domains/
src/context_library/adapters/
src/context_library/storage/
src/context_library/retrieval/
src/context_library/scheduler/
- Create placeholder module files (each containing only a module docstring) in each sub-package:
core/: pipeline.py, differ.py, embedder.py, versioner.py, chunker.py
domains/: base.py, messages.py, notes.py, events.py, tasks.py
adapters/: base.py
storage/: document_store.py, vector_store.py, models.py
retrieval/: query.py, reranker.py, provenance.py
scheduler/: poller.py, watcher.py
- Create a
tests/ directory at the project root mirroring the sub-package structure:
tests/__init__.py
tests/core/__init__.py
tests/domains/__init__.py
tests/adapters/__init__.py
tests/storage/__init__.py
tests/retrieval/__init__.py
tests/scheduler/__init__.py
Design Guidance
- The
src/ layout (not flat) is required. It prevents accidental imports of the development package during testing.
__init__.py files are empty.
- Each placeholder
.py module contains only a docstring describing the component's role, derived from the architecture. Example docstrings:
core/pipeline.py: """Orchestrates the full ingestion pipeline: fetch → normalize → diff → chunk → embed → store."""
core/differ.py: """Computes diffs between normalized content versions to detect real changes."""
core/embedder.py: """Wraps the embedding model; converts chunk text to dense vectors."""
core/versioner.py: """Manages source version records and content-addressed chunk hashing."""
core/chunker.py: """Delegates domain-specific chunking; applies the recursive markdown chunking algorithm."""
domains/base.py: """Abstract base class defining the BaseDomain interface."""
domains/messages.py: """MessagesDomain: chunking and metadata for email, chat, and forum content."""
domains/notes.py: """NotesDomain: chunking and metadata for freeform notes."""
domains/events.py: """EventsDomain: time-windowed summaries for structured event records."""
domains/tasks.py: """TasksDomain: one-task-per-chunk strategy with lifecycle state tracking."""
adapters/base.py: """Abstract BaseAdapter defining the adapter contract."""
storage/document_store.py: """SQLite-backed document store; source of truth for versions, chunks, and lineage."""
storage/vector_store.py: """LanceDB-backed vector index; derived and fully rebuildable from the document store."""
storage/models.py: """Shared Pydantic data models: Chunk, LineageRecord, SourceVersion, VersionDiff."""
retrieval/query.py: """Semantic query interface combining vector search with optional metadata filters."""
retrieval/reranker.py: """Reranks vector search results using cross-encoder or lexical signals."""
retrieval/provenance.py: """Traces chunk provenance via SQLite: version diffs, source history, lineage chains."""
scheduler/poller.py: """Polling-based ingestion trigger; manages per-adapter poll intervals."""
scheduler/watcher.py: """Push/webhook-based ingestion trigger for real-time adapter events."""
- Dependency direction (must not be violated in future implementation):
scheduler → core
adapters → core (types only)
core → domains, storage
retrieval → storage
- Nothing depends on
adapters or scheduler
Acceptance Criteria
Parent Issue
Part of #1
Discussion
This work is detailed in discussion 2
Establish the full
src/context_library/package hierarchy with all sub-packages and placeholder module files, mirrored by a paralleltests/directory structure.Requirements
src/context_library/as the root Python package with__init__.py__init__.py:src/context_library/core/src/context_library/domains/src/context_library/adapters/src/context_library/storage/src/context_library/retrieval/src/context_library/scheduler/core/:pipeline.py,differ.py,embedder.py,versioner.py,chunker.pydomains/:base.py,messages.py,notes.py,events.py,tasks.pyadapters/:base.pystorage/:document_store.py,vector_store.py,models.pyretrieval/:query.py,reranker.py,provenance.pyscheduler/:poller.py,watcher.pytests/directory at the project root mirroring the sub-package structure:tests/__init__.pytests/core/__init__.pytests/domains/__init__.pytests/adapters/__init__.pytests/storage/__init__.pytests/retrieval/__init__.pytests/scheduler/__init__.pyDesign Guidance
src/layout (not flat) is required. It prevents accidental imports of the development package during testing.__init__.pyfiles are empty..pymodule contains only a docstring describing the component's role, derived from the architecture. Example docstrings:core/pipeline.py:"""Orchestrates the full ingestion pipeline: fetch → normalize → diff → chunk → embed → store."""core/differ.py:"""Computes diffs between normalized content versions to detect real changes."""core/embedder.py:"""Wraps the embedding model; converts chunk text to dense vectors."""core/versioner.py:"""Manages source version records and content-addressed chunk hashing."""core/chunker.py:"""Delegates domain-specific chunking; applies the recursive markdown chunking algorithm."""domains/base.py:"""Abstract base class defining the BaseDomain interface."""domains/messages.py:"""MessagesDomain: chunking and metadata for email, chat, and forum content."""domains/notes.py:"""NotesDomain: chunking and metadata for freeform notes."""domains/events.py:"""EventsDomain: time-windowed summaries for structured event records."""domains/tasks.py:"""TasksDomain: one-task-per-chunk strategy with lifecycle state tracking."""adapters/base.py:"""Abstract BaseAdapter defining the adapter contract."""storage/document_store.py:"""SQLite-backed document store; source of truth for versions, chunks, and lineage."""storage/vector_store.py:"""LanceDB-backed vector index; derived and fully rebuildable from the document store."""storage/models.py:"""Shared Pydantic data models: Chunk, LineageRecord, SourceVersion, VersionDiff."""retrieval/query.py:"""Semantic query interface combining vector search with optional metadata filters."""retrieval/reranker.py:"""Reranks vector search results using cross-encoder or lexical signals."""retrieval/provenance.py:"""Traces chunk provenance via SQLite: version diffs, source history, lineage chains."""scheduler/poller.py:"""Polling-based ingestion trigger; manages per-adapter poll intervals."""scheduler/watcher.py:"""Push/webhook-based ingestion trigger for real-time adapter events."""scheduler→coreadapters→core(types only)core→domains,storageretrieval→storageadaptersorschedulerAcceptance Criteria
src/context_library/__init__.pyexistscore,domains,adapters,storage,retrieval,schedulersub-packages exists with an__init__.pytests/directory exists with__init__.pyand one sub-directory per package, each containing__init__.pysrc/ortests/contains executable code (imports, class/function definitions)Parent Issue
Part of #1
Discussion
This work is detailed in discussion 2