Thank you for your interest in contributing to PubMed Search Builder!
We welcome contributions in these areas:
If you've validated a new search filter (diagnostic accuracy, prognosis, qualitative studies, etc.), please add it to references/validated-methodological-filters-and-hedges.md with:
- Filter name and source (Cochrane, McMaster HIRU, PubMed Clinical Queries, etc.)
- PubMed syntax
- Version (sensitivity-maximising, specificity-maximising, balanced)
- Link to published validation study
- Example use case
- New search strategy examples for different evidence types
- Improved tutorials or workflow documentation
- Translations of key concepts to other languages
- Clarifications on ambiguous sections
- Bug fixes in
pubmed_tool.py,mesh_tool.py,hooks_tool.py, ormanifest_tool.py - Performance improvements
- Better error messages
- New command-line options or features
- Test coverage
Found a bug? Please open a GitHub issue with:
- Python version
- Operating system
- The exact command that failed
- Full error message (output from
--helpfirst, then your command) - Steps to reproduce
- What you expected to happen
Have an idea? Open a GitHub issue describing:
- The problem you're trying to solve
- Your proposed solution
- Why this would be useful to others
- Alternative approaches you considered
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/pubmed-search-builder.git cd pubmed-search-builder - Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Test your changes (see below)
- Commit with clear messages:
git commit -m "Add support for [feature]" -m "Description of the change"
- Push to your fork:
git push origin feature/your-feature-name
- Open a Pull Request on GitHub
- Clone the repository (see above)
- Install Python 3.10+
- Create a
.envfile with your NCBI credentials (see INSTALL.md) - Test your setup:
python scripts/pubmed_tool.py doctor
This repository commits equivalent project hooks for Codex (.codex/hooks.json) and
Claude Code (.claude/settings.json). They load run state at session and subagent start,
screen prompts for likely secrets, require material PubMed commands to use
scripts/workflow_tool.py, and run the complete-loop manifest gate before handoff.
Project hooks run only after the workspace is trusted. Inspect and approve them with
/hooks; Codex records trust against the current hook hash, so hook changes require a new
review. Claude Code likewise requires workspace trust and exposes its active project hooks
through /hooks. Non-managed hooks can be disabled there for diagnostics.
Create or attach a run before material search work:
python scripts/workflow_tool.py init --manifest /path/to/run/run_manifest.json --topic-slug demo
python scripts/workflow_tool.py attach --manifest /path/to/run/run_manifest.json
python scripts/workflow_tool.py status --manifest /path/to/run/run_manifest.jsonAt Audit output, create the deterministic handoff through the workflow wrapper so the export is registered atomically with the exact strategy input hash:
python scripts/workflow_tool.py export-final --manifest /path/to/run/run_manifest.json --strategy /path/to/run/strategy.txt --output /path/to/run/final_strategy.mdThe complete-loop and Stop gates require this export to occur after final QA and the
final PubMed count, and require its sole strategy input hash to equal the one hash shared
by both validation entries. Direct export_final.py calls are blocked by both clients.
Use manifest_tool.py state set-question when the workflow legitimately pauses for a user
decision. For a longer pause or an abandoned build, record state set-run-status paused or
abandoned with a reason. The Stop hook allows those states; otherwise it continues an
incomplete handoff once and then reports the remaining gaps without forming a loop.
Run hook and completion tests with:
python -m unittest tests.test_codex_hooks tests.test_manifest_complete_loop tests.test_workflow_tool
python scripts/repository_hygiene.pyThe hooks are local-only. They read event JSON, the selected run manifest, and local
artifacts; they do not access the network or read session transcripts. Session-to-run
pointers live under the gitignored .codex/state/ directory.
If you modify pubmed_tool.py, mesh_tool.py, or hooks_tool.py:
-
Syntax check:
python -m py_compile scripts/pubmed_tool.py python -m py_compile scripts/mesh_tool.py python -m py_compile scripts/hooks_tool.py python -m py_compile scripts/manifest_tool.py
-
Run the tool:
python scripts/pubmed_tool.py doctor python scripts/mesh_tool.py lookup --label "Asthma" python scripts/hooks_tool.py final-qa --strategy-file /tmp/test.txt -
Test with real queries:
# Count-test a simple query python scripts/pubmed_tool.py search "asthma[Mesh]" --retmax 0 # Fetch a known PMID python scripts/pubmed_tool.py fetch --pmids 24102982 --output fetch_24102982.json
- Check for typos and clarity
- Verify any code examples work (test in isolation if possible)
- Ensure links and file paths are correct
- Follow PEP 8 (readable, indented with 4 spaces)
- Use type hints where possible
- Add docstrings to functions
- Avoid hard-coded API keys or credentials
- Never print sensitive information
Example:
def example_function(param: str) -> dict:
"""
Short description.
Args:
param: Description of param.
Returns:
Dictionary with results.
"""
result = {}
# Your code here
return result- Use clear headings (
#,##,###) - Include code blocks with language tags:
# Good - Link to related docs
- Keep line length ~80 characters for readability
Write clear, descriptive commit messages:
Short description of the change (50 chars max)
Longer explanation if needed. Explain the *why*, not the *what*.
Wrap at ~72 characters.
Related to issue #123
- Keep it focused: One feature or fix per PR
- Add description: Explain what you changed and why
- Link issues: Reference any related GitHub issues
- Test: Confirm your changes work (especially for tools)
- Document: Update relevant documentation if needed
Example PR description:
## Summary
Add support for [feature].
## Changes
- Modified `pubmed_tool.py` to [brief description]
- Added example to `references/examples.md`
## Testing
Tested with:
- `python scripts/pubmed_tool.py [command]`
- Query: "asthma[Mesh]" -> count = 12345 (as expected)
Closes #123
By contributing, you agree that your contributions are licensed under the MIT License (see LICENSE).
Open a GitHub issue or discussion. We're here to help!
Thank you for making PubMed Search Builder better!