Task configuration:
{"task_id": "06", "task_name": "\u6dfb\u52a0\u5e26\u6709\u4e0a\u6807\u5361\u7247", "description": "\u6dfb\u52a0\u4e00\u5f20\u95ee\u7b54\u9898\u5361\u7247\u5230\u7cfb\u7edf\u9ed8\u8ba4\uff0c\u6b63\u9762\u4e3ax^2-2x+1=0\uff0c\u9700\u4f7f\u7528\u4e0a\u6807\u5b8c\u6210,x^2\u5b57\u4f53\u4e3a\u7ea2\u8272\uff0c\u80cc\u9762\u4e3ax=1", "application_info": {"name": "anki", "executable_path": "/home/agent/anki/out/pyenv/bin/python", "args": ["/home/agent/anki/tools/run.py"], "cwd": "/home/agent/anki"}, "task_parameters": {}, "instruction_template": "\u6dfb\u52a0\u4e00\u5f20\u95ee\u7b54\u9898\u5361\u7247\u5230\u7cfb\u7edf\u9ed8\u8ba4\uff0c\u6b63\u9762\u4e3ax^2-2x+1=0\uff0c\u9700\u4f7f\u7528\u4e0a\u6807\u5b8c\u6210\u3002\u5e76\u4e14x^2\u9700\u8981\u6807\u8bb0\u5b57\u4f53\u4e3a\u7ea2\u8272\uff0c\u80cc\u9762\u4e3ax=1", "evaluation_setup": {"scripts": [{"role": "hook", "path": "hooker.js", "dependency": ["../common/hooker_common.js"]}, {"role": "handler", "path": "handler.py"}], "timeout": 60}, "events": {"card_added": {"description": "\u6570\u636e\u5e93\u4e2d\u51fa\u73b0\u5361\u7247", "is_key_step": true, "key_step_index": 1, "key_step_name": "\u6570\u636e\u5e93\u4e2d\u51fa\u73b0\u5361\u7247"}, "correct_field": {"description": "\u5361\u7247\u6570\u636e\u5339\u914d", "is_key_step": true, "key_step_index": 2, "key_step_name": "\u5361\u7247\u6570\u636e\u5339\u914d"}, "wrong_field": {"description": "\u5361\u7247\u6570\u636e\u4e0d\u5339\u914d", "is_key_step": false}, "correct_format": {"description": "\u5361\u7247\u683c\u5f0f\u5339\u914d", "is_key_step": false}, "wrong_format": {"description": "\u5361\u7247\u683c\u5f0f\u4e0d\u5339\u914d", "is_key_step": false}}, "sql_path": "/home/agent/.local/share/Anki2/sam/collection.anki2", "total_key_steps": 2, "mcp_servers": [{"command": "/home/agent/anki-mcp-server/.venv/bin/python", "args": ["/home/agent/anki-mcp-server/run_server.py"]}]}

Hook script:
const TRACE_FUNCTION = [
    "storage_add_card"
]
function initHooks() {
    // iterate function name and addr, init it.
    for (const function_name of TRACE_FUNCTION){
        initHook(function_name, TRACE_MAPS[function_name]);
    }
}
initHooks();
sendLog("info", "add hooks done");

Evaluation handler:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
sys.path.append(os.path.dirname(__file__))
from common import *
import re

def check_first_field(s) -> bool:
    s = s.replace("&nbsp","")
    red_pattern1 = r'color.*rgb(255'
    red_pattern2 = r'color.*red'
    if not re.findall(red_pattern1,s) and not re.findall(red_pattern2,s):
        return False
    
    if not re.findall(r'x\s*<sup>\s*2\s*</sup>\s*</span>\s*\-\s*2x\s*\+\s*1\s*=\s*0',s):
        return False
    
    return True
    
    
def handle_storage_add_card(context: Context,message) -> Status:
    context.update_database()
    latest : Card = sorted(AnkiObjMap().array_by_type("card"),key=lambda x: x.mod,reverse=True)[0]
    note = latest.get_note()
    status = Status(status=StatusType.PROGRESS)
    status.emit(EventCardAdded())
    if len(note.fields) != 2:
        return status

    second_field = "x=1"

    print(check_first_field(note.fields[0]))
    if check_first_field(note.fields[0]) and note.fields[1] == second_field:
        status.emit(EventCorrectField())
        status.emit(EventCorrectFormat())
    elif second_field == note.fields[1] and "x" in note.fields[0] and "2" in note.fields[0] and "-2x+1=0" in note.fields[0]:
        status.emit(EventCorrectField())
        status.emit(EventWrongFormat(f"{note.fields[0]}","""<span style="color: red;">x<sup>2</sup></span>-2x+1=0"""))
    else:
        status.emit(EventWrongField(note.fields,f"[{'<span style="color: red;">x<sup>2</sup></span>-2x+1=0'} {second_field}]"))
    return status
      
TRACE_HANDLERS = {
    "storage_add_card": handle_storage_add_card
}   
dependency_graph = {
    card_added_ : [],
    correct_field_ : [card_added_],
    wrong_field_ : [card_added_],
    correct_format_ : [card_added_],
    wrong_format_ : [card_added_]
}
finished_list = [
    correct_field_,correct_format_
]

bind_handlers(TRACE_HANDLERS,dependency_graph,finished_list)