Quest: Work Governance Priority: P3 Status: open
Build provenance tracking — link every DB change to agent + task + commit
This task is part of the Work Governance quest (Senate layer). It contributes to the broader goal of building out SciDEX's senate capabilities.
get_db_write() in scidex/core/database.py to auto-populate journal_context from environment variables (SCIDEX_TASK_ID, SCIDEX_COMMIT_HASH, SCIDEX_AGENT_ID, ORCHESTRA_SLOT, SCIDEX_MODEL). This ensures all DB writes via journaled_update_by_keys() and journaled_delete_by_keys() carry provenance context. Verified with test upsert — db_write_journal now shows populated task_id, commit_hash, agent_id, slot_id fields. Commit 88e755b64.