references/subagent-prompt-template.md
3.4 KB查看排版效果| 1 | # Subagent Translation Prompt Template |
| 2 | |
| 3 | Two parts: |
| 4 | 1. **`02-prompt.md`** — Shared context (saved to output directory). Contains background, glossary, challenges, and principles. No task-specific instructions. |
| 5 | 2. **Subagent spawn prompt** — Task instructions passed when spawning each subagent. One subagent per chunk (or per source file if non-chunked). |
| 6 | |
| 7 | The main agent reads `01-analysis.md` (if exists), inlines all relevant context into `02-prompt.md`, then spawns subagents in parallel with task instructions referencing that file. |
| 8 | |
| 9 | Replace `{placeholders}` with actual values. Omit sections marked "if analysis exists" for quick mode. |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ## Part 1: `02-prompt.md` (shared context, saved as file) |
| 14 | |
| 15 | ```markdown |
| 16 | You are a professional translator. Your task is to translate markdown content from {source_lang} to {target_lang}. |
| 17 | |
| 18 | ## Target Audience & Style |
| 19 | |
| 20 | **Audience**: {audience description} |
| 21 | |
| 22 | **Target style**: {style description — e.g., "storytelling: engaging narrative flow, smooth transitions, vivid phrasing" or custom style from user} |
| 23 | |
| 24 | **Source voice** (from analysis, if exists): {Brief description of the original author's voice — formal/conversational, humor, register, sentence rhythm.} |
| 25 | |
| 26 | ## Content Background |
| 27 | |
| 28 | {Inlined from 01-analysis.md if analysis exists: content summary, core argument, author background, context.} |
| 29 | |
| 30 | ## Glossary |
| 31 | |
| 32 | Apply these term translations consistently. First occurrence: include original in parentheses. |
| 33 | |
| 34 | {Merged glossary — one per line: English → Translation} |
| 35 | |
| 36 | ## Translation Challenges |
| 37 | |
| 38 | {Inlined from 01-analysis.md §1.4 if analysis exists. Comprehension gaps, figurative language, structural challenges with suggested approaches:} |
| 39 | |
| 40 | - **{term/passage}**: {challenge type} → {suggested approach} |
| 41 | |
| 42 | ## Translation Principles |
| 43 | |
| 44 | Rewrite the content into natural, engaging {target_lang} — not merely translate it. Every sentence should read as if a skilled native writer composed it from scratch. |
| 45 | |
| 46 | - **Accuracy first**: Facts, data, and logic must match the original exactly |
| 47 | - **Natural flow**: Use idiomatic {target_lang} word order. Break long source sentences into shorter, natural ones. Interpret metaphors and idioms by intended meaning, not word-for-word |
| 48 | - **Terminology**: Use glossary translations consistently. Annotate with original in parentheses on first occurrence of specialized terms |
| 49 | - **Preserve format**: Keep all markdown formatting (headings, bold, italic, images, links, code blocks) |
| 50 | - **Proactive interpretation**: For jargon or concepts the target audience may lack context for, add concise explanations in **bold parentheses** `(**解释**)`. Keep annotations few — only where genuinely needed |
| 51 | ``` |
| 52 | |
| 53 | --- |
| 54 | |
| 55 | ## Part 2: Subagent spawn prompt (passed as Agent tool prompt) |
| 56 | |
| 57 | ### Chunked mode (one subagent per chunk, all spawned in parallel) |
| 58 | |
| 59 | ``` |
| 60 | Read the translation instructions from: {output_dir}/02-prompt.md |
| 61 | |
| 62 | You are translating chunk {NN} of {total_chunks}. |
| 63 | Context: {brief description of what this chunk covers and where it sits in the overall argument} |
| 64 | |
| 65 | Translate this chunk: |
| 66 | 1. Read `{output_dir}/chunks/chunk-{NN}.md` |
| 67 | 2. Translate following the instructions in 02-prompt.md |
| 68 | 3. Save translation to `{output_dir}/chunks/chunk-{NN}-draft.md` |
| 69 | ``` |
| 70 | |
| 71 | ### Non-chunked mode |
| 72 | |
| 73 | ``` |
| 74 | Read the translation instructions from: {output_dir}/02-prompt.md |
| 75 | |
| 76 | Translate the source file and save the result: |
| 77 | 1. Read `{source_file_path}` |
| 78 | 2. Save translation to `{output_path}` |
| 79 | ``` |
文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。

