Task configuration:
{"task_id": "13", "task_name": "\u67e5\u627e\u66ff\u6362", "description": "\u6dfb\u52a0\u4e00\u5f20\u5361\u7247\uff0c\u6b63\u9762\u4e3aWhat is this?\u3002\u7136\u540e\u67e5\u627e\u6240\u6709\u5e26\u6709What\u7684\u5361\u7247\uff0c\u5c06\u5176\u66ff\u6362\u4e3aWhere\u3002\u8bf7\u4f7f\u7528\u67e5\u627e\u6279\u91cf\u66ff\u6362\uff0c\u56e0\u4e3a\u53ef\u80fd\u6709\u5f88\u591a\u6761", "application_info": {"name": "anki", "executable_path": "/home/agent/anki/out/pyenv/bin/python", "args": ["/home/agent/anki/tools/run.py"], "cwd": "/home/agent/anki"}, "instruction_template": "\u6dfb\u52a0\u4e00\u5f20\u5361\u7247\uff0c\u6b63\u9762\u4e3a\"What is this?\"\u3002\u7136\u540e\u67e5\u627e\u6240\u6709\u5e26\u6709What\u7684\u5361\u7247\uff0c\u5c06\u5176\u66ff\u6362\u4e3aWhere\u00b7\u8bf7\u4f7f\u7528\u67e5\u627e\u6279\u91cf\u66ff\u6362\uff0c\u56e0\u4e3a\u53ef\u80fd\u6709\u5f88\u591a\u6761", "evaluation_setup": {"scripts": [{"role": "hook", "path": "hooker.js", "dependency": ["../common/hooker_common.js"]}, {"role": "handler", "path": "handler.py"}], "timeout": 60}, "events": {"card_added": {"description": "\u6dfb\u52a0\u4e86\u5361\u7247", "is_key_step": true, "key_step_index": 1, "key_step_name": "\u6dfb\u52a0\u4e86\u5361\u7247"}, "search_card_called": {"description": "\u8c03\u7528\u4e86\u67e5\u627e\u51fd\u6570", "is_key_step": true, "key_step_index": 2, "key_step_name": "\u8c03\u7528\u4e86\u67e5\u627e\u51fd\u6570"}, "replace_card_success": {"description": "\u8c03\u7528\u4e86\u66ff\u6362\u51fd\u6570", "is_key_step": true, "key_step_index": 3, "key_step_name": "\u8c03\u7528\u4e86\u66ff\u6362\u51fd\u6570"}}, "sql_path": "/home/agent/.local/share/Anki2/sam/collection.anki2", "total_key_steps": 3, "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",
    "storage_update_note",
    "service_serach_cards",
    "service_find_and_replace",
]
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 *

def handle_service_search_cards(context: Context,message) -> Status:
    status = Status()
    status.emit(EventSearchCardCalled())
    return status

# def handle_service_find_and_replace(context: Context,message) -> Status:    
#     if not context.should_event_trigger(EventSearchCardCalled()):
#         return None
#     context.update_database()
#     status = Status()
#     cards : List[Card] = list(filter(lambda card: card.cid in context.cards_prepare_to_check ,AnkiObjMap().array_by_type("card")))
#     if all(["Where" in " ".join(card.get_note().fields) for card in cards]):
#         status.emit(EventReplaceCardSuccess())
#     return status

def handle_storage_add_card(context: Context,message) -> Status:
    context.update_database()
    cards : List[Card] = sorted(AnkiObjMap().array_by_type("card"),key=lambda x: x.mod,reverse=True)
    note = cards[0].get_note()
    status = Status()
    print("aaa")
    if len(note.fields) == 2 and "What" in note.fields[0]:
        status.emit(EventCardAdded())
        status.mark_progress()
        context.cards_prepare_to_check = list(map(lambda c: c.cid,filter(lambda c:"What" in c.get_note().fields[0],cards)))
        print(context.cards_prepare_to_check)

    return status

def handle_storage_update_note(context: Context,message) -> Status:
    if not context.should_event_trigger(EventSearchCardCalled()):
        return None
    context.update_database()
    status = Status()
    cards : List[Card] = list(filter(lambda card: card.cid in context.cards_prepare_to_check ,AnkiObjMap().array_by_type("card")))
    if all(["Where" in " ".join(card.get_note().fields) for card in cards]):
        status.emit(EventReplaceCardSuccess())
    return status

TRACE_HANDLERS = {
    "storage_add_card": handle_storage_add_card,
    "service_serach_cards" : handle_service_search_cards,
    # "service_find_and_replace" : handle_service_find_and_replace,
    "storage_update_note" : handle_storage_update_note,
}   
dependency_graph = {
    card_added_ : [],
    search_card_called_ : [card_added_],
    replace_card_success_ : [search_card_called_]
}
finished_list = [
    replace_card_success_
]

bind_handlers(TRACE_HANDLERS,dependency_graph,finished_list)