feat: implement AtoCore Phase 0 + Phase 0.5 (foundation + PoC)
Complete implementation of the personal context engine foundation:
- FastAPI server with 5 endpoints (ingest, query, context/build, health, debug)
- SQLite database with 5 tables (documents, chunks, memories, projects, interactions)
- Heading-aware markdown chunker (800 char max, recursive splitting)
- Multilingual embeddings via sentence-transformers (EN/FR)
- ChromaDB vector store with cosine similarity retrieval
- Context builder with project boosting, dedup, and budget enforcement
- CLI scripts for batch ingestion and test prompt evaluation
- 19 unit tests passing, 79% coverage
- Validated on 482 real project files (8383 chunks, 0 errors)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 09:21:27 -04:00
|
|
|
"""Structured logging for AtoCore."""
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
2026-04-05 17:53:23 -04:00
|
|
|
import atocore.config as _config
|
feat: implement AtoCore Phase 0 + Phase 0.5 (foundation + PoC)
Complete implementation of the personal context engine foundation:
- FastAPI server with 5 endpoints (ingest, query, context/build, health, debug)
- SQLite database with 5 tables (documents, chunks, memories, projects, interactions)
- Heading-aware markdown chunker (800 char max, recursive splitting)
- Multilingual embeddings via sentence-transformers (EN/FR)
- ChromaDB vector store with cosine similarity retrieval
- Context builder with project boosting, dedup, and budget enforcement
- CLI scripts for batch ingestion and test prompt evaluation
- 19 unit tests passing, 79% coverage
- Validated on 482 real project files (8383 chunks, 0 errors)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 09:21:27 -04:00
|
|
|
import structlog
|
|
|
|
|
|
|
|
|
|
_LOG_LEVELS = {
|
|
|
|
|
"DEBUG": logging.DEBUG,
|
|
|
|
|
"INFO": logging.INFO,
|
|
|
|
|
"WARNING": logging.WARNING,
|
|
|
|
|
"ERROR": logging.ERROR,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup_logging() -> None:
|
|
|
|
|
"""Configure structlog with JSON output."""
|
2026-04-05 17:53:23 -04:00
|
|
|
log_level = "DEBUG" if _config.settings.debug else "INFO"
|
feat: implement AtoCore Phase 0 + Phase 0.5 (foundation + PoC)
Complete implementation of the personal context engine foundation:
- FastAPI server with 5 endpoints (ingest, query, context/build, health, debug)
- SQLite database with 5 tables (documents, chunks, memories, projects, interactions)
- Heading-aware markdown chunker (800 char max, recursive splitting)
- Multilingual embeddings via sentence-transformers (EN/FR)
- ChromaDB vector store with cosine similarity retrieval
- Context builder with project boosting, dedup, and budget enforcement
- CLI scripts for batch ingestion and test prompt evaluation
- 19 unit tests passing, 79% coverage
- Validated on 482 real project files (8383 chunks, 0 errors)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 09:21:27 -04:00
|
|
|
|
|
|
|
|
structlog.configure(
|
|
|
|
|
processors=[
|
|
|
|
|
structlog.contextvars.merge_contextvars,
|
|
|
|
|
structlog.processors.add_log_level,
|
|
|
|
|
structlog.processors.TimeStamper(fmt="iso"),
|
|
|
|
|
structlog.dev.ConsoleRenderer()
|
|
|
|
|
if settings.debug
|
|
|
|
|
else structlog.processors.JSONRenderer(),
|
|
|
|
|
],
|
|
|
|
|
wrapper_class=structlog.make_filtering_bound_logger(
|
|
|
|
|
_LOG_LEVELS.get(log_level, logging.INFO)
|
|
|
|
|
),
|
|
|
|
|
context_class=dict,
|
|
|
|
|
logger_factory=structlog.PrintLoggerFactory(),
|
|
|
|
|
cache_logger_on_first_use=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_logger(name: str) -> structlog.BoundLogger:
|
|
|
|
|
"""Get a named logger."""
|
|
|
|
|
return structlog.get_logger(name)
|