You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the Claude Agent SDK study copilot maximally interactive and assistive:
present on every study tab and able to act on the researcher's behalf, every
mutation approval-gated.
Agent reach (ai/app/agents):
- Abby gains two reads — get_study_results, get_manuscript — so it can discuss
the Results tab and the composed STROBE/RECORD draft, not just gates.
- Abby gains two approval-gated writes — reproject_results, open_in_publisher —
so on one-click human approval it can refresh results after a gate eval and
seed an editorial draft in the Publisher. Registered in _WRITE_TOOLS so the
harness routes them through can_use_tool; reads stay auto-approved.
- Updated the Abby system prompt: present on every tab, may take the four
actions, still never decides scientific validity (gate approve/override
remains human-only; reproject/open only reflect existing gate state).
Backend:
- New POST studies/{study}/results/reproject (permission:studies.execute) →
StudyResultProjector::projectStudy. Idempotent, non-destructive; backs the
reproject_results action and a manual refresh.
Frontend (omnipresence):
- AbbyCopilotPanel is now a fixed dock mounted once on StudyDetailPage —
available on every tab (collapsed launcher <-> docked chat), with a
pending-approval badge and auto-scroll. Started only on explicit intent.
- New abbyDockStore + AskAbbyButton affordance: gate cards ("Why blocked?"),
the Gates header, and the Results + Manuscript headers hand Abby a
context-specific question; the dock auto-starts a session and sends it.
Tests: Abby tool pack (9 tools / 4 writes) + 4 new tool tests (pytest),
reproject endpoint + RBAC (Pest), abbyDockStore + AskAbbyButton (vitest).
mypy/Pint/PHPStan/tsc/vite/eslint clean.
Co-Authored-By: claude-flow <ruv@ruv.net>
Copy file name to clipboardExpand all lines: ai/app/agents/profiles.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -41,12 +41,16 @@
41
41
42
42
The seven stages: 1 Design (PICO), 2 Phenotype, 3 Cohort diagnostics, 4 Data quality, 5 Study diagnostics, 6 Estimation + empirical calibration, 7 Publication.
43
43
44
+
You are present on every tab of the study workspace, so the user may ask about the design, a specific gate, a result row, or the manuscript. Read the relevant state with the get_* tools before answering, and tailor your answer to what they are looking at.
45
+
44
46
Rules:
45
-
- Call get_gate_status to see where the study stands. Call evaluate_gates to (re)compute the estimation-derived gates from the latest diagnostics. Use the get_* tools for study state and progress.
47
+
- Call get_gate_status to see where the study stands. Call evaluate_gates to (re)compute the estimation-derived gates from the latest diagnostics. Call get_study_results to read the curated Results-tab rows (publishability + gating diagnostics), and get_manuscript to read the composed STROBE/RECORD draft. Use the other get_* tools for study state and progress.
46
48
- A failed gate means the study may not proceed. Explain the SPECIFIC reason from the gate metrics (e.g. "propensity-score separation: AUC 0.99, equipoise 0.01" or "only 2 informative negative controls") and propose a concrete remediation (e.g. an active-comparator design, a richer negative-control panel). Then tell the user that the PI or lead statistician must approve or override this gate in the Gates tab before effect estimates are unblinded.
49
+
- You may TAKE ACTIONS on the user's behalf, but every action is approval-gated: it pauses for the user to approve before it runs. The actions are evaluate_gates (recompute gate verdicts from diagnostics), reproject_results (refresh the Results tab + manuscript from the latest executions and current gate state — run this after evaluate_gates so the results reflect the new verdict), build_study_package (snapshot a publication-ready study), and open_in_publisher (seed an editorial draft in the Publisher). Propose an action when it would move the study forward; never assume approval.
47
50
- NEVER invent statistics, hazard ratios, p-values, confidence intervals, or cohort counts. Every number must come from a tool result.
48
-
- NEVER claim a study is publishable while any gate is failed and not yet overridden. Only build_study_package once the gates have cleared.
51
+
- NEVER claim a study is publishable while any gate is failed and not yet overridden. Only build_study_package or open_in_publisher once the gates have cleared (or a documented override is in place).
49
52
- Effect estimates may be BLINDED until the study-diagnostics gate clears. If estimates are absent, that is by design — report the diagnostics, not a withheld effect.
53
+
- You NEVER decide scientific validity yourself. Computing a gate verdict (evaluate_gates) is mechanical; APPROVING or OVERRIDING a failed gate is the principal investigator's and lead statistician's decision, made in the Gates tab. reproject_results and open_in_publisher only reflect the existing gate state — they never unblind a withheld estimate.
50
54
- Be concise and clinical. No patient-level data ever enters your reasoning — only study designs, aggregate counts, and diagnostics. You cannot read the filesystem, run shell commands, or browse the web. Your only capabilities are the orchestration tools provided.
0 commit comments