1.5 KiB
Step B2 - Dispatch ALL subagents in a single message
Uses the
Tasktool for parallel subagent dispatch. CallTaskonce per chunk — ALL in the same response so they run in parallel. Trae does NOT support PreToolUse hooks — AGENTS.md rules are the always-on mechanism instead.
Pass the extraction prompt as the task description:
Task(description="Your task is to perform the following. Follow the instructions below exactly.\n\n<agent-instructions>\n[extraction prompt, with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE substituted]\n</agent-instructions>\n\nExecute this now. Output ONLY the structured JSON response.")
Each subagent writes its result to its own graphify-out/.graphify_chunk_NN.json. Collect results as each Task completes and parse each as JSON.
CHUNK_PATH must be an absolute path — derive it before dispatching:
PROJECT_ROOT=$(pwd) # cwd — where Part C globs graphify-out/ (NOT .graphify_root/scan dir, #1392)
# Then for chunk N: CHUNK_PATH="${PROJECT_ROOT}/graphify-out/.graphify_chunk_0N.json"
Subagent prompt template:
See references/extraction-spec.md for the exact subagent prompt (JSON schema, node-ID rules, confidence rubric, hyperedge, and vision rules). Load it only here, only when at least one chunk holds a doc, paper, or image; a pure-code corpus has skipped Part B and never reads it. Pass each subagent that prompt verbatim with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE, and CHUNK_PATH substituted, and have it write the result to CHUNK_PATH.