A precise, reliable AI assistant platform for researchers working with open science tools. Built for accuracy over scale; serving small research communities from lab servers.
All development follows: Issue -> Feature Branch (from develop) -> PR to develop -> Review -> Merge
Branch Strategy:
main- Production releases only, auto-deploys to prod- Always has stable versions (no
.devsuffix) - CI automatically strips
.devsuffix if merged accidentally - Releases tagged with
--latestflag
- Always has stable versions (no
develop- Integration branch, auto-deploys to dev- Has
.devsuffix on versions (e.g.,0.5.1.dev0)
- Has
feature/*- Feature branches, created from and merged todevelop
Version Management (Fully Automated — do not manually bump in release PRs):
developbranch: Versions end with.devNsuffix (e.g.,0.5.1.dev0,0.5.1.dev1)mainbranch: Versions are stable, no suffix (e.g.,0.5.1)- On every push to
develop(.github/workflows/auto-bump-dev.yml):- Increments
.devN(e.g.,0.5.1.dev0->0.5.1.dev1) - Skips on bot commits,
Bump version to ...messages,[skip ci],[skip-bump]
- Increments
- When
src/version.pychanges onmain:ensure-stable-version.ymlstrips.devsuffix if presenttag-release.ymlcreates git tag (e.g.,v0.5.1)release.ymlcreates GitHub release marked as "latest"
- After every stable release on main (
.github/workflows/sync-develop.yml):- Merges
mainback intodevelop - Bumps
developto<next-patch>.dev0(e.g.,0.5.2.dev0) - This avoids the manual "resolve
src/version.pyconflict in release PR" dance
- Merges
- Manual version bumps use
scripts/bump_version.py(rarely needed — the automation handles dev increments and post-release sync)
- Pick an issue from GitHub Issues
- Create feature branch from develop:
git checkout develop && git pull && git checkout -b feature/issue-N-short-description - Implement with atomic commits
- Review using
/pr-review-toolkit:review-prbefore creating PR - Address ALL review findings - fix critical AND important issues, not just critical
- Create PR to develop:
gh pr create --base develop - Squash and merge:
gh pr merge --squash --delete-branch(always squash to keep history clean)
# Example workflow
gh issue list # Find issue to work on
git checkout develop && git pull # Start from develop
git checkout -b feature/issue-7-interfaces # Create branch
# ... implement ...
git add -A && git commit -m "feat: add X" # Atomic commits
/pr-review-toolkit:review-pr # Review before PR
# FIX ALL ISSUES from review (critical + important)
gh pr create --base develop --title "feat: add X" --body "Closes #7"
git push -u origin feature/issue-7-interfaces
gh pr merge --squash --delete-branch # SQUASH MERGE to keep history cleanAvailable labels for issues and PRs (check with gh label list before creating new ones):
Priority:
P0- Blocker, must fix before releaseP1- Critical, fix as soon as possibleP2- Important, fix when possible
Type:
bug- Something isn't workingfeature- New feature or enhancementenhancement- New feature or requestdocumentation- Improvements or additions to documentationsecurity- Security vulnerability or hardening
Category:
testing- Testing and quality assuranceoperations- Operations, monitoring, and observabilityobservability- Logging, monitoring, and debuggingdeveloper-experience- Improves developer experiencewidget- Related to frontend widgetcost-management- Cost tracking and optimization
Status:
good first issue- Good for newcomershelp wanted- Extra attention is neededduplicate- This issue or pull request already existsinvalid- This doesn't seem rightquestion- Further information is requestedwontfix- This will not be worked on
Adding new labels:
- Create the label:
gh label create "label-name" --description "Description" --color "hexcolor" - Update this list in CLAUDE.md
- Precision over features: Researchers need accurate, citation-backed answers
- Simple infrastructure: Lab server deployment, no complex scaling
- Extensible tools: General tool system that communities can adapt for their needs
- Domain expertise: Deep knowledge of specific tools, not broad generalist
Target: Multiple small research communities (HED, BIDS, EEGLAB, etc.), each with specific tool needs. The platform provides robust infrastructure; communities customize tools and prompts.
# Setup environment (uses uv for dependency management)
uv sync
# Development server
uv run uvicorn src.api.main:app --reload --port 38528
# Run tests
uv run pytest tests/ -v
# Linting
uv run ruff check .
uv run ruff format .
# CLI usage
uv run osa --helpsrc/
├── api/ # FastAPI backend
│ ├── main.py # App entry point, health check
│ ├── config.py # Settings (pydantic-settings)
│ └── security.py # API key auth, BYOK
├── cli/ # Typer CLI
│ ├── main.py # CLI commands
│ ├── client.py # HTTP client
│ └── config.py # User config (~/.config/osa)
├── agents/ # LangGraph agents
│ ├── state.py # State definitions
│ └── base.py # BaseAgent, SimpleAgent, ToolAgent
├── core/services/ # Business logic
│ └── llm.py # LLM provider abstraction
└── tools/ # Document retrieval tools
When working on different parts of the system, start with these documents:
- .context/api-structure.md - START HERE for API work
- Community-based routing (
/{community_id}/ask,/chat, etc.) - Model selection logic and provider routing
- Common implementation mistakes and how to avoid them
- How to add new communities
- Community-based routing (
- .context/api_key_authorization_design.md - API key auth and CORS
- .context/security-architecture.md - Security patterns
- Full docs site: https://docs.osc.earth/osa/registry/ (canonical reference)
- Adding a Community - Step-by-step guide
- Local Testing - Testing a new community end-to-end
- Schema Reference - Full YAML config schema
- Extensions - Python plugins and MCP servers
- .context/yaml_registry.md - YAML-based community config (internal notes)
- .context/community_onboarding_review.md - Onboarding gap analysis
- .context/local-testing-guide.md - Quick local testing reference
- .context/community-admin-merge.md - Community maintainer "LGTM/merge" comment command to merge community-scoped PRs into develop (setup + trust model)
- Existing configs to reference:
src/assistants/hed/config.yaml,src/assistants/eeglab/config.yaml
- .context/tool-system-guide.md - How tools work and are registered
- Architecture - High-level system diagrams
- .context/plan.md - Implementation roadmap and current tasks
- .context/research.md - Technical notes, target project resources
- .rules/ - Code style, testing, conventions
- NO MOCKS: Real tests with real data only
- Dynamic tests: Query registries/configs, don't hardcode values (see
.rules/testing_guidelines.md) - Coverage: >70% minimum
- LLM testing: Use exemplar scenarios from real cases
- Run
uv run pytest --covbefore committing
- ruff for formatting/linting (pre-commit hooks)
- Type hints required
- Docstrings for public APIs
- Follow the Development Workflow (see top of file)
- Atomic commits, concise messages, no emojis
- Feature branches from
develop, PRs targetdevelop mainis production only; mergedevelop->mainfor releases- ALWAYS squash merge - keep develop history clean with single commit per feature
- Use PR review toolkit before creating PRs
- Address ALL review issues (critical + important) before merging
- Use Serena MCP for efficient code exploration via Language Server Protocol (LSP)
- Prefer symbolic tools over reading full files
- Key tools:
mcp__serena__get_symbols_overview: See file structure without reading full contentmcp__serena__find_symbol: Locate specific classes/functions/methodsmcp__serena__find_referencing_symbols: Find where symbols are usedmcp__serena__search_for_pattern: Search for text patterns when symbol name unclear
- Workflow: Overview → Locate → Read only what's needed
- See
.serena/memories for detailed usage patterns
- HED: Hierarchical Event Descriptors (annotation standard)
- BIDS: Brain Imaging Data Structure (data organization)
- EEGLAB: EEG analysis MATLAB toolbox
Simple, single-instance deployment:
- In-memory state (no PostgreSQL needed)
- Direct document fetching (no vector DB needed)
- LangFuse for observability (optional)
- Deployment patterns from HEDit when ready
To access and test the backend server:
# SSH into the backend server (via jump host)
ssh -J hallu hedtools
# Backend repo location on server
cd ~/osa
# Deploy to dev
deploy/deploy.sh dev
# Check service status
docker ps
docker logs osa-dev
# Manual sync trigger
docker exec osa-dev python -m src.cli.main sync github --fullAPI Endpoints:
Frontend:
Knowledge databases (SQLite) live inside the Docker containers, not locally.
Do NOT look for .db files in the local repo; they won't be there.
# List databases in a container
ssh -o "RequestTTY=no" -J hallu hedtools \
"docker exec osa find /app/data/knowledge -name '*.db'"
# Containers: osa (prod), osa-dev (dev)
# Database paths: /app/data/knowledge/{community_id}.db
# e.g., /app/data/knowledge/eeglab.db, /app/data/knowledge/hed.db
# List tables (no sqlite3 binary; use python)
ssh -o "RequestTTY=no" -J hallu hedtools \
"docker exec osa python3 -c 'import sqlite3; conn = sqlite3.connect(\"/app/data/knowledge/eeglab.db\"); print([r[0] for r in conn.execute(\"SELECT name FROM sqlite_master WHERE type=\\\"table\\\"\")]); conn.close()'"
# Query example: count docstrings
ssh -o "RequestTTY=no" -J hallu hedtools \
"docker exec osa python3 -c 'import sqlite3; conn = sqlite3.connect(\"/app/data/knowledge/eeglab.db\"); print(conn.execute(\"SELECT COUNT(*) FROM docstrings\").fetchone()[0]); conn.close()'"
# Query example: search for a symbol
ssh -o "RequestTTY=no" -J hallu hedtools \
"docker exec osa python3 -c 'import sqlite3; conn = sqlite3.connect(\"/app/data/knowledge/eeglab.db\"); [print(r) for r in conn.execute(\"SELECT symbol_name, file_path FROM docstrings WHERE symbol_name LIKE \\\"%erpimage%\\\"\").fetchall()]; conn.close()'"Important notes:
sqlite3CLI is not installed in containers; usepython3 -cwith thesqlite3module- Use
ssh -o "RequestTTY=no"to avoid interactive shell banners - Dev and prod databases may differ; always check the right container
- API structure:
.context/api-structure.md(read first for API work) - Architecture: docs.osc.earth/osa/architecture (high-level diagrams)
- Plan:
.context/plan.md(current roadmap) - Research notes:
.context/research.md(technical deep-dives) - HED tools analysis:
.context/hed_tools_analysis.md - HEDit (deployment patterns):
/Users/yahya/Documents/git/annot-garden/hedit - QP (doc retrieval patterns):
/Users/yahya/Documents/git/HED/qp
All HED-related repositories: /Users/yahya/Documents/git/HED/
- hed-python: Python validator library
- hed-web: Flask REST API (hedtools.org)
- hed-javascript: Browser-based validator
- hed-resources: User documentation (markdown source)
- hed-specification: Technical specification (markdown source)
- hed-schemas: Schema definitions (JSON/XML)
- hed-standard.github.io: Website source (hedtags.org)