Ask OpenEvidence MCP for a focused verdict.
Use the OpenEvidence MCP oe_ask tool. Keep the prompt focused and include:
question id, exact stem, all options, current DB answer, and the requested
output schema.
Request structured output like:
{
"id": "114-007",
"current_answer": "B",
"best_answer": "E",
"verdict": "agree | disagree | uncertain | needs_review",
"confidence": "high | medium | low",
"reason": "short rationale",
"option_notes": {
"A": "why right/wrong",
"B": "why right/wrong"
},
"article_id": "OpenEvidence article id if available"
}
For many questions, batch only when the combined prompt stays easy to audit;
otherwise handle questions one at a time.
Update D1 after approval.
Before writing, re-read the current row so the update is based on the latest
DB state. Use a temp SQL file for multi-statement updates and escape strings
through a real JSON/SQL helper, not manual editing.
Minimum answer-change pattern:
INSERT INTO answer_history
(question_id, previous_answer, new_answer, source, challenge_id, changed_by, changed_at)
SELECT id, answer, answer, 'original', NULL, NULL,
strftime('%s','now') * 1000
FROM questions
WHERE id = '<QID>'
AND NOT EXISTS (SELECT 1 FROM answer_history WHERE question_id = '<QID>');
INSERT INTO answer_history
(question_id, previous_answer, new_answer, source, challenge_id, changed_by, changed_at)
SELECT id, answer, '<NEW_ANSWER>', 'admin', NULL, 'ppoiu87@gmail.com',
strftime('%s','now') * 1000
FROM questions
WHERE id = '<QID>' AND answer <> '<NEW_ANSWER>';
UPDATE questions
SET answer = '<NEW_ANSWER>'
WHERE id = '<QID>' AND answer <> '<NEW_ANSWER>';
UPDATE answer_challenges
SET status = 'archived',
resolved_at = strftime('%s','now') * 1000,
resolution_reason = 'admin:answer-edit'
WHERE question_id = '<QID>' AND status IN ('open', 'contested');
Explanation-change pattern when the explanation row exists:
UPDATE explanations
SET content_json = '<TIPTAP_JSON>',
version = COALESCE(version, 0) + 1,
updated_by = 'ppoiu87@gmail.com',
updated_at = strftime('%s','now') * 1000,
editing_by = NULL,
editing_until = NULL,
stale_since = NULL
WHERE question_id = '<QID>';
INSERT INTO explanation_history (question_id, version, content_json, updated_by, updated_at)
SELECT question_id, version, content_json, updated_by, updated_at
FROM explanations
WHERE question_id = '<QID>';
If the explanation row is missing, insert version 1 and then snapshot that
inserted row instead of running the update:
INSERT INTO explanations (question_id, content_json, version, updated_by, updated_at, stale_since)
VALUES ('<QID>', '<TIPTAP_JSON>', 1, 'ppoiu87@gmail.com',
strftime('%s','now') * 1000, NULL);
INSERT INTO explanation_history (question_id, version, content_json, updated_by, updated_at)
SELECT question_id, version, content_json, updated_by, updated_at
FROM explanations
WHERE question_id = '<QID>';
If the repo has active answer challenges for this question, archive or resolve
them according to the current table schema after confirming column names.
Verify the write.
Query the changed row, answer history, and explanation history:
wrangler d1 execute hema-2026-db --remote --json --command \
"SELECT id, answer FROM questions WHERE id = '<QID>';
SELECT question_id, previous_answer, new_answer, source, challenge_id, changed_by, changed_at
FROM answer_history WHERE question_id = '<QID>' ORDER BY changed_at;
SELECT question_id, version, updated_by, updated_at
FROM explanations WHERE question_id = '<QID>';
SELECT question_id, version, updated_by, updated_at
FROM explanation_history WHERE question_id = '<QID>' ORDER BY updated_at;"
Also inspect the rendered TipTap text if explanation JSON changed.