EcoOracle
EcoOracle is an MCP server plus registry pipeline for answering ecosystem questions across many R/Python packages. Primary goal: let users build new scripts outside package repos by retrieving canonical usage recipes and API cards.
It is designed so package onboarding is deterministic:
- package repo opts in with
.ecosystem.yml - package CI publishes
atlas-pack.tgzat release tageco-atlas eco-registrydiscovery updatesregistry.jsonnightly- MCP server loads registry and serves
eco_howto,eco_symbol,eco_packages,eco_where_used
Canonical registry repository: https://github.com/bbuchsbaum/eco-registry.
What Lives Here
packages/eco-oracle-mcp: MCP servertools/eco_atlas_extract.R: extract symbols/snippets/edgestools/eco_atlas_distill.mjs: distill snippets into microcardstools/eco-atlas.yml: package-side workflow template that builds and publishesatlas-pack.tgzeco-registry: registry repo and nightly discovery workflowschemas: data contracts for cards, symbols, edges, manifest, registry
End-to-End Flow
- Package repo includes
.ecosystem.yml. - Package workflow builds atlas files and publishes
atlas-pack.tgzto release tageco-atlas. eco-registry/.github/workflows/discover-registry.ymlruns nightly at04:00 UTC(and on manual dispatch).- Discovery script scans owner repos, finds
.ecosystem.yml, resolves release assets, and writeseco-registry/registry.json. - MCP server refreshes from registry and caches atlas packs locally.
- Claude/Codex sessions call the MCP tools to generate external scripts.
Add A New Package (Turnkey)
Do this in the target package repository.
Fastest path with an agent:
- ask:
Add this package to the ecosystem - if
eco-joinskill is available, it scaffolds the required files/workflow.
Fastest path from R:
# install.packages("remotes")
remotes::install_github("bbuchsbaum/eco-oracle")
library(ecooracle)
# initial scaffold
ecooracle::use_ecooracle()
# refresh workflow/tool templates later without hand edits
ecooracle::use_ecooracle(overwrite = TRUE)
# or run commit/push/workflow/discovery without prompts
ecooracle::use_ecooracle(
commit = TRUE,
push = TRUE,
run_workflow = TRUE,
run_discovery = TRUE
)
# check local onboarding health
ecooracle::check_health()
- Add
.ecosystem.ymlat repo root:
ecosystem: true
package: mypkg
language: R
role: transform
tags: [domain-tag, canonicalization]
entrypoints:
- mypkg::main_fn
- mypkg::read_input
# optional overrides (defaults shown)
release_tag: eco-atlas
asset: atlas-pack.tgz
- Add atlas tooling to the package repo:
- copy
tools/eco_atlas_extract.R - copy
tools/eco_atlas_distill.mjs - copy
.github/workflows/eco-atlas.ymlfromtools/eco-atlas.yml
If you use ecooracle::use_ecooracle(), these files are scaffolded for you. Re-run it with overwrite = TRUE to refresh an existing package to the current template set. The helper also fills placeholder role/tags/entrypoints from DESCRIPTION and NAMESPACE, and in interactive sessions it can ask whether to commit, push, trigger eco-atlas.yml, and trigger registry discovery.
- Configure package secrets:
OPENAI_API_KEYfor distillation step
- Push to
main(or run workflow manually):
- verify release tag
eco-atlascontains assetatlas-pack.tgz
- Wait for registry discovery (nightly) or trigger
discover-registrymanually ineco-registry.
Example manual trigger:
gh workflow run discover-registry.yml --repo bbuchsbaum/eco-registry
- Verify package is in registry:
cat eco-registry/registry.json
- Verify MCP can load it:
node packages/eco-oracle-mcp/dist/index.js
# then call eco_refresh and eco_packages from your MCP client
No manual registry edits should be required in normal operation.
Manual Hints: Exactly Where To Put Them
If you want package-specific guidance to improve retrieval quality, put it in the package repository, not in eco-registry/registry.json.
Hard rule:
- Do not manually edit
eco-registry/registry.jsonfor package hints. - Nightly discovery rewrites
registry.json. - Manual edits there are temporary and will be lost.
Put hints in durable source locations in the package repo:
.ecosystem.yml
- set
role,tags,entrypoints
R/*.R
- add
# ECO:howto ...markers above canonical snippets
README.Rmd/vignettes/*.Rmd
- include canonical code fences for real workflows
manual_cards.jsonl(optional, deterministic overrides)
- add hand-authored microcards that are merged into final
atlas/cards.jsonl - if
idcollides with generated card id, manual card wins
Manual cards file contract:
- File path:
manual_cards.jsonlat package repo root (default; override withECO_ATLAS_MANUAL_CARDS_PATH) - One JSON object per line
- Required fields per record:
q,a,recipe,symbols
- Optional fields:
id,tags,package,language,sources
Example manual_cards.jsonl line:
{"id":"manual.bidser.load_project","q":"How do I load a BIDS project in R?","a":"Use bidser::bids_project() on the dataset root, then inspect scans with func_scans().","recipe":"library(bidser)\nproj <- bidser::bids_project('/path/to/bids')\nscans <- bidser::func_scans(proj)","symbols":["bidser::bids_project","bidser::func_scans"],"tags":["bids","ingest"]}
Example # ECO:howto snippet:
# ECO:howto How do I load a BIDS project?
library(bidser)
proj <- bidser::bids_project("/path/to/bids")
scans <- bidser::func_scans(proj)
What gets overwritten by automation:
eco-registry/registry.jsonis regenerated by discovery.atlas/cards.jsonland releaseatlas-pack.tgzare regenerated by package atlas workflow.
What does not get overwritten:
.ecosystem.ymlcommitted in the package repo.# ECO:howtomarkers and package docs committed in the package repo.
Operational flow for manual hints:
- Commit hint changes in the package repo.
- Run/push package
eco-atlasworkflow so a newatlas-pack.tgzis published. - Wait for nightly discovery (or trigger it manually).
- Run
eco_refreshin client and verify behavior witheco_howto/eco_symbol.
Registry Automation Setup (Do Once In eco-registry)
Set these in the eco-registry GitHub repo:
- Secret:
GH_ORG_PAT
- token must read target owner repositories and push to
eco-registry
- Variable:
ECO_OWNER
- owner to scan, org or user (for example
bbuchsbaum)
- Optional variable:
ECO_ORG
- backward-compatible fallback
Discovery supports both GitHub orgs and users.
Run The MCP Server Locally
From this repo:
npm install
npm run build --workspace=packages/eco-oracle-mcp
node packages/eco-oracle-mcp/dist/index.js
Environment:
ECO_REGISTRY_URLorECO_REGISTRY_PATH(set at least one)ECO_GITHUB_TOKEN(optional, needed for private release assets)ECO_CACHE_DIR(optional, default~/.cache/eco-oracle)ECO_REFRESH_SECS(optional, default600)
Use From Claude Code
User scope:
claude mcp add --transport stdio eco-oracle --scope user -- npx -y eco-oracle-mcp
Project scope (.mcp.json):
{
"mcpServers": {
"eco-oracle": {
"type": "stdio",
"command": "npx",
"args": ["-y", "eco-oracle-mcp"],
"env": {
"ECO_REGISTRY_URL": "https://raw.githubusercontent.com/bbuchsbaum/eco-registry/main/registry.json",
"ECO_GITHUB_TOKEN": "${ECO_GITHUB_TOKEN}"
}
}
}
}
Copy-Paste Directive: Ecosystem-First (Compatible with oh-my-claude)
Use this in CLAUDE.md, AGENTS.md, or as the first message in a fresh Claude/Codex session:
## Internal package policy (eco-oracle MCP only)
This policy refers only to the `eco-oracle` MCP server.
Do not activate or invoke any other skill/mode (including `oh-my-claudecode:ecomode`) unless the user explicitly asks.
For R code, prefer ecosystem packages discovered via eco-oracle MCP.
Workflow is mandatory:
1. Call `eco_howto` first for each "How do I...?" subtask.
2. Call `eco_symbol` for each function you plan to use.
3. Use ecosystem packages/functions in final code.
Do not introduce non-ecosystem packages (for example `RNifti`, `oro.nifti`, `ANTsR`) unless:
1. eco-oracle returns no viable result, and
2. you explicitly ask for user approval before using external packages.
When answering, include:
1. `Ecosystem packages used: ...`
2. `Functions used: ...`
3. `Fallback needed: yes/no`
Quick prompt to reinforce behavior in any new session:
Use eco-oracle MCP as source of truth. Do not enable oh-my-claude modes/skills unless I explicitly request them. Ecosystem-only solution unless no match exists; if no match, ask me before using external packages.
Shortcut session opener (equivalent):
Enter ecosystem mode.
Use From Codex
User scope:
codex mcp add eco-oracle -- npx -y eco-oracle-mcp
Or in ~/.codex/config.toml:
[[mcp_servers]]
name = "eco-oracle"
command = "npx"
args = ["-y", "eco-oracle-mcp"]
[mcp_servers.env]
ECO_REGISTRY_URL = "https://raw.githubusercontent.com/bbuchsbaum/eco-registry/main/registry.json"
ECO_GITHUB_TOKEN = "${ECO_GITHUB_TOKEN}"
MCP Tools
eco_howto(query, ...)eco_symbol(symbol, ...)eco_packages(...)eco_where_used(symbol, ...)eco_refresh()
Operational Checklist
For each package:
.ecosystem.ymlpresent and valid.eco-atlasworkflow runs onmain.- Release tag
eco-atlashasatlas-pack.tgz.
For registry:
- Nightly discovery workflow succeeds.
registry.jsonupdates automatically.- New packages appear without manual edits.
For clients:
- MCP config points at correct registry URL/path.
eco_refresh()returns expected package/card/symbol counts.






