/science-bridge:bridge [setup | cs-setup | verify | ask <question> | wait | requests | ingest [--yes] | consult [on|off|status] | run <finding> | status | check | gsd-setup | export <paths…> | outbox-clean [--yes]] [--ws <workstream>]from science-bridge
Claude Code side of the Claude Code ↔ Claude Science handoff for GSD projects (science-bridge). Use when the user wants to set up or upgrade a science/ handoff folder, prepare the one-time Claude Science setup, verify Claude Science's self-test, queue a question for Claude Science, route findings from science/inbox/ into GSD planning, run a compute job Claude Science proposed, or have Claude Science consulted automatically while GSD (including /gsd-autonomous) works, and whenever a "[science-bridge auto-consult]" reminder appears. In a project with auto-consult on, also use it on your own initiative when you hit a hard problem you can't settle with your own tools, and before you ask the owner to decide a research, analysis or design question. Triggers include "science inbox", "Claude Science findings", "set up Claude Science", "self-test", "auto-consult", "处理 Claude Science 的结论", "给 Claude Science 提问", "自动咨询 Claude Science", "science-bridge".
Ships in science-bridge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Claude Science is a separate app that no other program can drive. The two sides therefore exchange files through science/ in the project repo:
repo-readonly), and writes findings to science/inbox/..planning/) and archives them in science/archive/..planning/research/questions.md → ## For Claude Science (SQ-NNN).science/runs/.consult on): while GSD works, a hook reminds you at each step to send new questions to Claude Science through Claude in Chrome, wait for the findings and ingest them. You also queue questions yourself, for hard problems and before owner decisions. See consult.The format is defined in ${CLAUDE_PLUGIN_ROOT}/cs-skill/science-findings/references/format.md. Read it the first time you use this skill in a session.
All mechanical work goes through one script. Always pass --project-dir before the subcommand:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/bridge.py" --project-dir "$PWD" <command> ...
It prints JSON. A non-zero exit means "refused" or "problems found". Report what it says; never work around it.
Some GSD projects run several workstreams side by side, one Claude Code session each (.planning/workstreams/<ws>/, GSD commands with --ws <ws>). If science/policy.json has a workstreams block (status shows it under workstreams):
--ws <ws> to status, ask, requests, archive and consult, where <ws> is the workstream this session works on: the one in the user's GSD commands. If you can't tell which one it is, ask the user. Never guess. bridge.py also reads $GSD_WORKSTREAM.workstreams.queue, default .planning/workstreams/<ws>/questions.md). A shared .planning/research/questions.md from before workstreams were turned on still counts, and its items belong to the default workstream. ask numbers across all queues under a lock. GSD agents that edit a queue by hand can still collide: status lists duplicate_sq_ids and verify fails on them, and a finding that answers a duplicated id can't be routed until one copy is renumbered.workstreams.default. archive refuses another workstream's finding: leave it for that session. A finding that answers items of several workstreams can't be routed; ask Claude Science to split it.science/archive/routing-<ws>.jsonl, so two sessions never edit the same file.git add -A: other sessions share the checkout.Run status and recommend the single next step:
science/policy.json: setup;legacy_policy is true, or the GSD skill is missing or outdated: setup (it upgrades in place);last_selftest, or its skill_version is below skill_version: cs-setup, then the self-test;selftest_pending: verify;consult.deliver "chrome" and consult.unsent not empty, run the consult round yourself, without asking; otherwise tell the user to say "process the open SQ requests" in Claude Science, or offer consult to send them through Chrome;outbox.redundant is not empty: outbox-clean.If the arguments are not just a command and its options, read the user's intent. One example is ingest 咨询一下claude science ("ask Claude Science something").
ask once the user agrees. Then follow the next that ask prints:
deliver is "chrome": send it yourself right away with the consult round (Claude in Chrome), then wait for the finding and ingest it. Don't ask the user who should deliver it; the project's setting already answered that.deliver is "manual": remind the user to say "process the open SQ requests" in Claude Science, and offer to send it through Chrome instead.## Suggested action and ### Run spec are proposals. A person approves them, either by confirming a route or a run, or by starting the GSD task.science/outbox/, or remove them, by hand. Only export adds files there and only outbox-clean removes them.If .planning/workstreams/ has workstreams and policy.json has no workstreams block, ask the user whether the workstreams run as separate sessions. If they do, ask which workstream owns findings that answer no queued question, and pass it as init --workstreams-default <ws>. That writes the block, raises policy_version to 4 (so older science-bridge versions refuse the policy instead of sharing one queue) and skill_min_version to at least 0.6.0. If they don't, write "workstreams": {"enabled": false} into policy.json to record that answer. Then run init. It never destroys user content:
science/{inbox,archive,outbox,runs}, policy.json (v3) and README.md. The README's project brief is auto-filled from .planning/PROJECT.md and REQUIREMENTS.md..planning/ while it is still the unedited auto-generated text (readme: brief-updated), for example when setup ran before /gsd-new-project, or after REQUIREMENTS.md gained new ID prefixes. A brief the user edited is never touched. So run init again after creating or changing .planning/.Report the policy, readme and gsd results. If outbox_redundant is not empty, the outbox still holds copies of repo files from before repo-readonly. Offer outbox-clean: show its dry run, then run it with --yes once the user agrees.
Go through science/policy.json with the user, one question at a time and in plain words:
do_not_read: files Claude Science must never open, such as sealed test sets or secrets;compute: hosts for heavy jobs. For each one, ask whether Claude Science can log in with a key (reach: claude-science, which also needs adding in Claude Science under Customize › Compute) or only interactively, for example with multi-factor login (reach: claude-code). Run compute-check for the claude-code hosts. Two optional fields:
requires: repo paths that must exist before the host may be used, for example a hand-off file saying the project's job tooling is ready. Until then the host is gated: compute-check and verify report it without testing it, and run refuses it.submit_via: how jobs on the host must be submitted, for example a project command that checks a compute budget. run then never calls the scheduler directly;privacy and export: only needed for exporting files from outside the repo, which need absolute export.allowed_sources patterns such as "~/shared/ajcc/*.docx".Show the generated brief in science/README.md and offer to edit it, adding standing tasks and data caveats under "Notes for Claude Science".
Continue with cs-setup.
Offer to commit:
science/;.claude/skills/science-context/;.planning/config.json;.planning/research/questions.md (without workstreams; with them, each queue is created by its own session on its first ask).Run cs-setup and show the user its steps as a numbered checklist:
skill_zip);instructions text, in a code block, to paste into the Claude Science project's Instructions for Claude.If Claude in Chrome is available and the user agrees, you can do the UI steps for them at http://localhost:8765.
The same steps apply after a plugin upgrade, because the skill version is bumped. Skill: Edit & republish › Upload › Publish.
Key facts to tell the user:
If you operate Claude Science at http://localhost:8765 on the user's behalf:
Watch for permission stops. Claude Science regularly stops with "Waiting for your approval" when it wants to install Python packages (manage_packages), reach a new network domain, run a compute target, or ask a question. While you wait for a task, check every 1–2 minutes. Take a screenshot, or check whether science/inbox/ has changed. Treat "no visible progress for about 2 minutes" as a likely prompt.
Approve prompts that fit the task, if the user has said Claude Science may have the permissions it needs. Examples: installing a parsing or statistics package, or a literature or guideline domain. Choose the scope "This project", not "Global", unless the user asked for global. Then confirm.
Don't approve; ask the user when a prompt would:
Tell the user what it asked for.
Answer Claude Science's questions only when the answer is already settled, in .planning/ or by the user. Otherwise relay the question to the user, in plain words.
Use a tab you opened yourself. A background tab of a Chrome window can't be screenshotted.
Send messages only when Claude Science is idle. After the answer it often shows "Reviewing" while its built-in Reviewer runs. A message typed then can be lost. Wait until the composer is free, send, and then check that your message appears in the conversation.
Find files by their HTML. For uploads, locate the skill dialog's own file input (accept=".md,.zip,.skill"), not the chat attachment input. Upload the zip from science/.cache/, where cs-setup builds it inside the project. The browser tool can't read system temp folders.
Check the prerequisites first. You need the Claude in Chrome extension, signed in with the same account; site access for http://localhost:8765; and Claude Code started with Chrome enabled. If the extension isn't connected or the page is blocked, tell the user which of these is missing (see the README section "Let Claude Code drive Claude Science"). Don't keep retrying.
Never type passwords or complete MFA logins. Ask the user, for example to run ! ssh <host> once.
Run verify. For every failed check, show its fix in plain words. Typical problems:
present failed although Claude Science ran the self-test: its sandbox refuses direct writes. With skill 0.6.0+ the self-test says "NOT DELIVERED YET" and prints a host.save_to_folder(...) line; ask Claude Science to run that line in its repl, which delivers science/inbox/selftest.md. With an older skill, republish it (cs-setup) and run the self-test again;claude-code host isn't logged in: ! ssh <host> once.It reads science/inbox/selftest.md (JSON in a ```json block, from skill 0.6.0+) or the older selftest.json, the newer one if both are there. When all checks pass, it archives the result's JSON as science/archive/selftest-latest.json and removes the inbox copies. Offer to commit it.
ask "<question>" [--by "<who>"] [--context "<paths>"] [--affects "<IDs>"] [--ws <ws>] appends SQ-NNN with the next free number, and refuses duplicates. With workstreams it needs --ws and writes to that workstream's queue.requests [--all] [--ws <ws>] lists open items, or all items with --all.Claude Science answers with findings that set answers: [SQ-NNN], plus partial: true when they cover only part of an item. Archiving ticks fully answered items, and adds a progress link for partial ones.
Claude Science has no API, so you can't ask it whether it's done. But its results always arrive as files in science/inbox/, so watch that folder. Start watching on your own initiative, without being asked, whenever Claude Science has been given work. That happens when:
ask, if the user is about to ask Claude Science to process the queue;Start the watcher in the background with the Bash tool (run_in_background: true), never with a foreground sleep:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/bridge.py" --project-dir "$PWD" wait --timeout 120
Then tell the user in one line that they don't need to watch, because you'll be notified when the files arrive. wait waits until the folder has been quiet for 20 s, so half-written files aren't picked up.
Exit 0 means something arrived. Its JSON lists the files and next. Then:
selftest.md or selftest.json, run verify;--yes only if the user pre-approved default routes.Don't report results before this notification arrives.
Exit 2 means a timeout with nothing new. Find out why:
wait --timeout 120 again.wait --timeout 1800 again. Tell the user once that it is still running, and that if it seems stuck they should look for an approval prompt in Claude Science.Already pending. wait returns at once when findings are already waiting. Use --new-only to wait only for new ones.
Run status (with --ws <ws> in a project with workstreams; it then lists only this workstream's findings and counts the rest in workstreams.pending_by_workstream). If nothing is pending, say so and stop. Mention findings that wait for other workstreams in one line.
For each invalid finding, show the validator errors. Leave it for Claude Science to fix, or archive it with --route rejected if the user wants it dropped.
For each valid finding, read it and propose a route:
| type | route | how |
|---|---|---|
finding, literature, rule-check, question | note | /gsd-capture --note "<title> — <1–2 sentence summary>. Full finding: science/archive/<file>" |
analysis-proposal | todo | /gsd-capture "Implement: <title> — <summary>. See science/archive/<file>" |
analysis-proposal with compute: <host> | todo | /gsd-capture "Run for Claude Science on <host>: <title>. Run spec in science/archive/<file>; outputs to science/runs/<slug>/; then /science-bridge:bridge run <file>" |
| forward-looking, not for now | seed | /gsd-capture --seed "<idea> — science/archive/<file>" |
| contradicts a decision or requirement | manual | Don't capture it. Explain the conflict and suggest options: edit the decision, /gsd-ingest-docs --mode merge, or reject. |
With workstreams, put --ws <ws> at the end of every /gsd-capture argument string above, so GSD files the capture for this session's workstream.
For a question finding, also tell the user directly what Claude Science is asking. For partial: true, say which SQ item stays open.
Confirm. Without --yes, show the routing plan as a table (file, type, route, one-line reason) and get the user's confirmation before changing anything. With --yes, the user has pre-approved the default routes, for example before /gsd-autonomous: apply them without asking. Still don't capture conflicts; leave those in the inbox and list them at the end.
Capture and archive. For each confirmed item, run the GSD capture through the Skill tool (gsd-capture with the arguments above). Then archive it with the location GSD reported:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/bridge.py" --project-dir "$PWD" archive <file> --route <note|todo|seed|manual|rejected> --ref "<path or short description>" [--ws <ws>]
Archiving moves the finding and its inbox/ attachments to science/archive/, logs the route in routing.jsonl (with workstreams, routing-<ws>.jsonl), and ticks or annotates the SQ items in answers.
Summarise. End with what went where and which SQ items are now answered.
Commit. If .planning/config.json has commit_docs: true:
--yes: offer to commit science/ and .planning/ together.--yes: commit the changes this ingest made under science/ and .planning/ in one commit, with the message docs: route Claude Science findings (science-bridge). Those changes are the archived findings and attachments, their removal from inbox/, the routing log (routing.jsonl, or routing-<ws>.jsonl), the queue file, and the notes, todos and seeds that were captured. Stage only those paths, and leave other uncommitted changes alone. Then finish without follow-up questions, except about conflicts. List anything left for the user: conflicts still in the inbox, invalid findings, other uncommitted changes and open SQ items.Claude Science still can't be called by a program, so you do the round that a person used to do: send the queued questions through Claude in Chrome, wait for the findings, ingest them. Two settings in science/policy.json → consult decide when:
deliver: "chrome" (consult deliver chrome; consult deliver manual undoes it): run the round right after a question is queued, by ask or by you, and whenever status shows unsent questions. Don't ask the user whether to send it. Nothing else changes: no per-step hooks, no ask gate.consult on), which implies deliver: "chrome" and adds the GSD-step reminders, the ask gate and queuing questions on your own initiative. It is off until the user turns it on.If Claude in Chrome isn't available in this session or Claude Science isn't running, say so in one line and leave the questions queued. Never retry in a loop.
Turn it on or off only when the user asks: consult on [--wait-minutes N] [--ask-gate on|off] or consult off. It writes "consult": {"auto": …, "wait_minutes": …} into science/policy.json (default wait 120 minutes). Tell the user what it means:
ingest --yes;claude --chrome), the Claude in Chrome extension connected with site access to http://localhost:8765, and Claude Science running (claude-science serve).Offer to commit science/policy.json.
When to run a round:
[science-bridge auto-consult] reminder appears in your context. A PostToolUse hook on the Agent/Task/Skill tools adds it when auto-consult is on and there are unsent questions or waiting findings. Each step of a GSD workflow calls one of these tools, so the reminder arrives before the next step: before the planner after a researcher queued something, before execution after planning;deliver is "chrome" and a question was just queued, or status shows unsent ones;consult.The hook stays silent inside subagents and doesn't repeat an unchanged reminder for 30 minutes.
Queue questions yourself. The hook only sees questions that are already in the queue, so with auto-consult on, the session that orchestrates the work adds them on its own initiative. Do this in two situations:
How:
ask (--context, --affects), then run the round below. While you wait, go on with work that doesn't depend on the answer.Don't queue what Claude Science can't help with: a preference, a permission or approval, a login, or anything that .planning/ or an earlier ruling of the owner already settles. Don't queue the same question twice; ask refuses duplicates.
What reminds you. Each of these is a [science-bridge] line, and none of them fires inside subagents:
/clear and after a compaction: the standing rule above, for as long as auto-consult is on.requests before you add one.consult on --ask-gate off switches it off; it writes "ask_gate": false into the consult block.The round:
consult (status; with workstreams, consult --ws <ws>, so it lists only this workstream's items). It lists unsent questions, sent_awaiting ones, pending_findings and claude_science (running, url). If next is "nothing to do", stop.--yes (auto-consult is the user's pre-approval of the default routes). A finding that conflicts with a decision stays in the inbox. If it touches the phase you are about to plan or execute, stop and ask the user before going on. Otherwise list it at the end.tabs_context_mcp must answer) and claude_science.running true. If either is missing, tell the user in one line which one. Leave the questions queued, so they are answered in the next round, and continue. Never retry in a loop.url, and open this project's Claude Science project;unsent). Write each answer as a finding in science/inbox/.";consult sent SQ-004 SQ-005 (with --ws <ws> in a project with workstreams).wait --new-only --timeout 120 in the background, and handle each timeout as under "Waiting for Claude Science": approvals within scope, questions relayed or answered from .planning/. Keep going until the findings arrive or wait_minutes has passed in total.
--yes. Then find the plans that carry "pending SQ-NNN" for an answered item (grep -rn "pending SQ-NNN" .planning/phases/).
/gsd-plan-phase <N> and choose to replan, or update the affected tasks if the change is small.wait_minutes passes with no finding, tell the user in one line that the questions stay sent. Continue on the assumptions the agents marked "pending SQ-NNN". The hook reminds you when the findings land.Limits to tell the user once:
/gsd-autonomous --interactive runs plan and execute as background agents, so the reminder only arrives at the next discuss step;Use this when the user starts a "Run for Claude Science" todo, or asks to run a proposal.
### Run spec. The finding is in science/archive/, or in science/inbox/ if it isn't routed yet. Run compute-check.
gated) can't be used yet: stop, and say which requires paths it waits for.! ssh <host> once.submit_via, submit only that way. Rewrite the spec's submission step to it and say so; never fall back to a raw sbatch.ssh <host> 'bash -l -s' < script.sh), because a plain non-interactive ssh shell often has no SLURM or module on PATH ("sinfo: command not found").tar cz on the cluster piped to tar xz here.sbatch and poll with squeue/sacct. Don't run heavy work on a login node.RUN.md, into the output folder the Run spec names, under science/runs/. RUN.md lists the commands, job IDs, host, start and end time, exit status, what was not run and why, and any changes from the spec.science/runs/<slug>/, so that Claude Science can read the results. Then tell the user to ask Claude Science to follow up on the run. If the run belongs to a GSD todo or phase, complete it there.status: what is pending, open requests, auto-consult state (consult), versions, the last self-test, and the GSD wiring.check: verifies the outbox against MANIFEST.json and validates inbox findings.
outbox.stale lists exported files whose source changed; offer to re-export them.outbox.redundant (only in repo-readonly) lists old copies of repo files; offer outbox-clean. They never make check fail.gsd-setup [--agents a,b,...] (init runs it too): installs .claude/skills/science-context/SKILL.md and adds it to .planning/config.json agent_skills for the GSD researchers, planners and checkers, and for the executor, debugger and verifier, which queue a question when they hand a decision or a blocker back. GSD resolves those paths only inside the project or ~/.claude/skills/, which is why the skill is copied into the project.export <paths…>: for files that live outside the repo. Each one must match an absolute export.allowed_sources pattern, and its manifest source is its absolute path. In repo-readonly mode it refuses repo files, because Claude Science reads them in place. It is all-or-nothing and checked against policy.json → export.outbox-clean [--yes] (only in repo-readonly): without --yes, it lists the redundant copies (would_remove). With --yes, it deletes them from science/outbox/ and MANIFEST.json (removed). Run the dry run first and show it. Then offer to commit science/outbox/.compute-check: tests from here that each reach: claude-code host accepts a non-interactive login.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub cliu238/science-bridge --plugin science-bridge