Skip to content

Add Edison Scientific deep research (PaperQA3) for community records#93

Merged
realmarcin merged 2 commits into
mainfrom
feat/edison-deep-research
May 29, 2026
Merged

Add Edison Scientific deep research (PaperQA3) for community records#93
realmarcin merged 2 commits into
mainfrom
feat/edison-deep-research

Conversation

@realmarcin
Copy link
Copy Markdown
Contributor

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 via md5). Domain-agnostic provenance capture: writes the answer .md plus -meta.yaml, -response.json, -citations.md, -agent-state.json, -files.json sidecars 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 the edison-client SDK directly (PaperQA is not a registered deep-research-client provider). Reuses research_community.py for load_community/resolve_community_file/template_vars and the existing templates/community_mechanism_research.md. Outputs to research/communities/. Accepts a filename stem, a CommunityMech: id, or a path. --dry-run writes the meta (with query_sha256) without spending credits.
  • scripts/enrich_edison_response.py — retroactive sidecar backfill for any meta with a task_id; metadata-only, no re-billing.
  • justfile: research-community-edison, research-community-edison-batch, enrich-edison-response.
  • pyproject dev extras: edison-client>=0.11.0, python-dotenv.

The deep-research-community skill 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_KEY and the legacy EDISON_API_KEY already in this repo's .env.

Testing

  • All scripts byte-compile.
  • resolve_community_file + render_query exercised against a real record (Aalborg_East_Full_Scale_EBPR_Community → 8,968-char rendered query) plus the batch loader.
  • justfile recipes parse and list.
  • Not exercised live: the Edison API call itself (needs credits + uv sync --extra dev); the SDK-call path is byte-for-byte from CultureMech's in-use code.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 29, 2026 20:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py and scripts/enrich_edison_response.py for running PaperQA3-class jobs and retroactively backfilling sidecars from task_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.

Comment thread scripts/enrich_edison_response.py Outdated
Comment thread scripts/research_community_edison.py Outdated
…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>
@realmarcin realmarcin merged commit 5597a4a into main May 29, 2026
1 check passed
@realmarcin realmarcin deleted the feat/edison-deep-research branch May 29, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants