Add Edison Scientific deep research (PaperQA3) for community records#93
Merged
Conversation
Port CultureMech's Edison deep-research feature to CommunityMech (phase-1 core scope): - Vendor _edison_capture.py byte-identical (shared provenance-capture plumbing: answer + meta + response.json + citations + agent-state + files). - research_community_edison.py: single + batch runner driving the edison-client SDK directly (PaperQA is not a registered DRC provider). Reuses research_community.py loaders/template_vars and the existing community_mechanism_research.md template; outputs to research/communities/. - enrich_edison_response.py: retroactive sidecar backfill, no re-billing. - justfile recipes (research-community-edison[-batch], enrich-edison-response) and edison-client/python-dotenv dev deps. The deep-research-community skill lives under .claude/ (gitignored in this repo, matching its other local skills) and is not part of this commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Ports CultureMech's Edison Scientific deep-research feature to CommunityMech as a phase-1 core scope. Adds direct edison-client SDK driver scripts for single + batch community literature research and retroactive provenance backfill, reusing the existing research_community.py loaders/template and the shared community mechanism research template.
Changes:
- New
scripts/_edison_capture.py(vendored byte-identical from CultureMech) centralizing answer/citation/agent-state/files sidecar writing and artifact fetching. - New
scripts/research_community_edison.pyandscripts/enrich_edison_response.pyfor running PaperQA3-class jobs and retroactively backfilling sidecars fromtask_id. - Just recipes (
research-community-edison,research-community-edison-batch,enrich-edison-response) and dev extras (edison-client>=0.11.0; python_version >= '3.12',python-dotenv>=1.0.0).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/_edison_capture.py | Shared, domain-agnostic Edison response capture helpers (md/meta/json/citations/files/artifacts). |
| scripts/research_community_edison.py | Single + batch Edison runner; reuses research_community.py loaders and template, supports --dry-run. |
| scripts/enrich_edison_response.py | Retroactive sidecar backfill scanning research/communities/*-edison-*-meta.yaml. |
| pyproject.toml | Adds edison-client (3.12+) and python-dotenv to the dev extras. |
| justfile | Wires three new recipes pointing at the templates/research dirs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…r datetime - _safe_rel: use resolve().relative_to() with ValueError fallback instead of a str.startswith prefix check (avoids /repo vs /repo2 false positives). - run_one: load the community YAML once and pass it into render_query instead of parsing it twice per target. - enrich: import datetime/timezone at module top (drop the __import__ hack) and guard research_dir.relative_to(REPO_ROOT) so an out-of-repo --research-dir no longer crashes the run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Ports CultureMech's Edison Scientific deep-research feature to CommunityMech, phase-1 core scope (single + batch literature search, full provenance capture, retroactive enrichment). Phase-2 / prioritize / apply are intentionally deferred pending per-entity design.
What's included
scripts/_edison_capture.py— vendored byte-identical from CultureMech (verified viamd5). Domain-agnostic provenance capture: writes the answer.mdplus-meta.yaml,-response.json,-citations.md,-agent-state.json,-files.jsonsidecars per task. Shared-by-copy convention (matches the existing DRC helper vendoring); future fixes must sync across the three Mech repos.scripts/research_community_edison.py— single + batch runner driving theedison-clientSDK directly (PaperQA is not a registereddeep-research-clientprovider). Reusesresearch_community.pyforload_community/resolve_community_file/template_varsand the existingtemplates/community_mechanism_research.md. Outputs toresearch/communities/. Accepts a filename stem, aCommunityMech:id, or a path.--dry-runwrites the meta (withquery_sha256) without spending credits.scripts/enrich_edison_response.py— retroactive sidecar backfill for any meta with atask_id; metadata-only, no re-billing.research-community-edison,research-community-edison-batch,enrich-edison-response.edison-client>=0.11.0,python-dotenv.The
deep-research-communityskill lives under.claude/(gitignored in this repo, matching its other local skills) and is intentionally not part of this PR.Auth
Honors both
EDISON_PLATFORM_API_KEYand the legacyEDISON_API_KEYalready in this repo's.env.Testing
resolve_community_file+render_queryexercised against a real record (Aalborg_East_Full_Scale_EBPR_Community→ 8,968-char rendered query) plus the batch loader.uv sync --extra dev); the SDK-call path is byte-for-byte from CultureMech's in-use code.🤖 Generated with Claude Code