Development guide
Contributor-focused workflows: local setup details stay in SETUP.md at the repo root (Windows, troubleshooting, MCP).Clone and install
make install runs uv sync --frozen --extra dev and the analytics install helper. Use uv run opensre … from the repo root so you always hit this checkout’s .venv, not another opensre on your PATH.
Quality gates (same as CI)
From the repo root:test-full): make check.
Before a PR, run at least make lint, make format-check, make typecheck, and make test-cov (see CONTRIBUTING.md).
Interactive shell action policy
Action-planner behavior, postprocessing transforms, compatibility seams, and the rule-extension checklist are documented indocs/interactive-shell-action-policy.md.
Package architecture
The eight first-party packages, the five-tier layering (which package may import which), the folder diagram, per-layer responsibilities, and cross-layer flows are documented indocs/ARCHITECTURE.md.
Tool registry — surface-scoped, lazy loading
Loading every vendor tool at startup was slow. A static index (tools/registry_index.py) reads tool metadata by scanning the source, without importing executors, so a turn loads only the tools it needs.
get_registered_tools(surface)imports only that surface’s tool modules.get_tool_descriptors(surface)returns metadata with no executor import.load_tool(descriptor)imports the executor, only when a tool runs.
@tool/BaseTool module; the index finds it and no other vendor is imported. tests/tools/test_registry_index.py checks the index matches the imported registry exactly, so they cannot drift.
VS Code dev container
The dev container is defined under.devcontainer/. It builds from .devcontainer/Dockerfile (Python 3.13), then postCreateCommand creates .venv-devcontainer and runs pip install -e '.[dev]' (not uv). Docker Desktop, OrbStack, Colima, or another compatible runtime must be available on the host.
Deployment
Full deployment instructions, prerequisites, and environment variable reference: DEPLOYMENT.md Quick reference:Hosted runtime (Railway / ECS / Vercel)
- Deploy the repository
Dockerfileand select the runtime withMODE(web,gateway, orscheduler). - Set
LLM_PROVIDERand the matching API key (for exampleANTHROPIC_API_KEY,OPENAI_API_KEY— see.env.example). - Set
DATABASE_URLwhen gateway records must be shared through Postgres (required for Slack Events API unless the single-replica local-dedup escape hatch is enabled). - Use a shared
OPENSRE_HOMEmount when multiple processes need the same scheduler tasks. IfOPENSRE_CONTEXT_ROOTis set, make that root durable and shared for organization-bound sessions too. - Add integration and storage env vars your deployment needs.
DATABASE_URL only when the gateway needs
shared records; Redis is not part of the gateway persistence path. Set
OPENSRE_DEPLOYMENT_METHOD=railway for telemetry labeling.
Telemetry and privacy
opensre ships with two telemetry stacks, both opt-out:
- Product analytics — lifecycle and usage events sent through
app.opensre.com(commands used, success/failure, rough runtime, CLI/Python/OS/arch, and limited command metadata). - Sentry — crashes and errors (stack traces, environment, release).
entrypoint, opensre.runtime, and deployment_method. Sensitive headers, paths, and secret-shaped keys are scrubbed before send.
Product events also carry execution_environment (local, ci, container,
or ci_container), is_ci, is_container, and container_runtime. Use these
first-party fields to exclude automated environments from product funnels.
A random install ID is stored under ~/.opensre/anonymous_id. Telemetry is off
in GitHub Actions and pytest.
When a user signs in to GitHub (wizard or /integrations setup), OpenSRE emits
github_username on subsequent product events.
Kill-switch matrix
Full opt-out:
Sentry DSN
Self-hosted users can setSENTRY_DSN to their project; unset uses the bundled default. SENTRY_DSN= (empty) drops events in before_send.
Deployment tagging
SetOPENSRE_DEPLOYMENT_METHOD to railway, ec2, vercel, or local (default local) to label Sentry events.
Local product event log
By default, outbound product event properties are also appended to~/.opensre/analytics_events.txt (rotates at 1000 lines). Disable:
$ai_generation
event contains redacted prompt and response text.