Repository navigation
feat: add knowledge sources database for HED discovery - #26
Merged
Merged
Conversation
Add SQLite + FTS5 database for syncing and searching HED-related
GitHub discussions and academic papers. This is for discovery only,
not as authoritative knowledge sources.
New features:
- Knowledge database with full-text search (FTS5)
- GitHub sync for hed-standard repos (issues/PRs via gh CLI)
- Paper sync from OpenALEX, Semantic Scholar, and PubMed APIs
- CLI commands: osa sync {init,github,papers,all,status,search}
- Agent tools: search_hed_discussions, search_hed_papers
- Optional API keys for higher rate limits
Files added:
- src/knowledge/{__init__,db,github_sync,papers_sync,search}.py
- src/cli/sync.py
- src/tools/knowledge.py
- tests/test_knowledge/{__init__,test_db,test_search}.py
Files modified:
- src/agents/hed.py (add new tools to HEDAssistant)
- src/cli/main.py (register sync_app)
- src/cli/config.py (add API key fields)
- tests/test_agents/test_{hed,page_context}.py (update tool counts)
Refs: #25
Add background scheduler for automated knowledge sync in Docker: - APScheduler for scheduled GitHub and papers sync - Database persistence via volume mount - Environment variables for API tokens (all optional) - docker-compose.yml for easy deployment Changes: - src/api/scheduler.py: Background scheduler with configurable cron - src/api/main.py: Start/stop scheduler on app lifecycle - src/api/config.py: Add sync settings and API key fields - src/cli/config.py: Support DATA_DIR env var for volume mount - deploy/Dockerfile: Install gh CLI, document volumes and env vars - deploy/docker-compose.yml: Production-ready compose file - deploy/.env.example: Example environment configuration - pyproject.toml: Add apscheduler dependency Sync schedules (configurable via env vars): - GitHub: Daily at 2am UTC (SYNC_GITHUB_CRON) - Papers: Weekly Sunday at 3am UTC (SYNC_PAPERS_CRON) Refs: #25
- Add knowledge sync settings to root .env.example - Remove duplicate deploy/.env.example - Update docker-compose.yml to use env_file from root Refs: #25
- Add _sanitize_fts5_query() helper that escapes user input - Wrap user queries in quotes to treat FTS5 operators as literals - Add tests for sanitization function and special character handling - Addresses code review finding on query injection vulnerability
Member
Author
Code Review Findings - AddressedFollowing the code review, the critical finding has been addressed: Critical: FTS5 Query Injection (Fixed in fd60760)
Important: Incremental Sync Logic (By Design)The comparison of Minor Findings (Acceptable)
|
neuromechanist
added a commit
to OpenScience-Collective/documentation
that referenced
this pull request
Jan 12, 2026
- Add knowledge-sync.md with CLI commands, Docker config, API keys - Update cli-reference.md with sync commands and env variables - Update mkdocs.yml navigation to include Knowledge Sync page Related to: OpenScience-Collective/osa#26
Member
Author
DocumentationDocumentation PR created: OpenScience-Collective/documentation#2 Covers:
The docs PR should be merged when this PR is merged to develop. |
This was referenced Jan 15, 2026
This was referenced Jan 15, 2026
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add SQLite + FTS5 database for syncing and searching HED-related GitHub discussions and academic papers. This is for discovery only, not as authoritative knowledge sources.
osa sync {init,github,papers,all,status,search}search_hed_discussions,search_hed_papersTest plan
osa sync init,osa sync github,osa sync status,osa sync searchCloses #25