Install
openclaw skills install @lumen01/agent-subtitle-translatorTranslate SRT, VTT, and ASS subtitles safely
openclaw skills install @lumen01/agent-subtitle-translatorTranslate only subtitle text with an available translation model. Delegate decoding, parsing, batching, marker validation, timeline mapping, and output writing to scripts/subtitle_tool.py. Never send timestamps or original ASS override tags to the model.
Run commands from this skill directory. The script uses only the standard library for UTF inputs; legacy encodings require charset-normalizer:
python3 -m pip install -r requirements.txt
python3 scripts/subtitle_tool.py --help
Do not request or configure an external LLM API key for the script. Use the translation capability already available to the executing agent.
127.0.0.1, stores task history under ~/.agent-subtitle-translator/visualizer, and accepts bridge requests only through that local service.output directory.The deterministic CLI workflow can run without a Web service. When the Agent or user chooses to observe progress in the visualizer, complete these steps before using the bridge:
requirements.txt, confirm Python can run scripts/subtitle_tool.py --help, confirm Node.js satisfies the package requirement (Node 20 or newer), install Node dependencies once with npm install, and run npm run build successfully.http://127.0.0.1:4317/api/health. Reuse the service only when the response is healthy, identifies subtitle-visualizer, and reports a compatible Skill version. Otherwise start the service after resolving any occupied-port conflict, then record the printed URL.identify, then create the task, start batches, submit and validate responses, and compose through visualizer:bridge. Keep reporting each meaningful operation in the Agent response.The commands in the sections below describe the direct deterministic CLI workflow and the safety rules implemented by the bridge. During an Agent visualizer run, use the equivalent bridge commands after the local service is healthy. Do not compose the same task and output path through both workflows.
Require a target BCP 47 tag. Accept an optional source tag; omit it to let the translation model detect the source language.
python3 scripts/subtitle_tool.py prepare /path/movie.ass \
--target-language zh-Hans \
--source-language en
Use --work-dir to choose the package location. The command otherwise creates a hidden sibling directory. Do not use --overwrite-work unless replacing that package is intentional.
Inspect the JSON report. Stop on decoding, empty-body, invalid-timeline, or structural errors. Note any out-of-order input and ASS karaoke IDs. Preparation creates:
manifest.json: local structure, mapping, and validation facts; do not send it to the model.batches/batch-NNNN.txt: ready-to-send prompts containing stable IDs and text, never timelines.validated/: destination for verified batch results.Each batch contains at most 32 entries. Do not increase that ceiling. Dispatch batches serially or concurrently using the agent's available scheduling; this skill imposes no concurrency limit.
Send each complete batch-NNNN.txt prompt to the translation model without rewriting its fixed instructions. Save the raw response as UTF-8 text.
Do not promise cross-batch consistency for names or terminology. The prompt supplies only the local batch context.
python3 scripts/subtitle_tool.py validate-response \
--manifest /path/work/manifest.json \
--batch 1 \
--response /path/responses/batch-0001.txt
On any count, ID, order, wrapper, hard-break, fixed-structure, or style-marker error, resend that batch with the original prompt and the validator error as a correction request. Never fill a missing translation from a neighboring entry.
If the retried response still has a count, ID, wrapper, BR, or F mismatch, stop the entire job. Reliable timeline mapping is impossible.
If only ASS S style markers remain invalid after a retry, validate with --allow-style-fallback. This removes inline style markers only for the affected entries and records their IDs. Do not use this option before a retry.
python3 scripts/subtitle_tool.py validate-response \
--manifest /path/work/manifest.json \
--batch 1 \
--response /path/responses/batch-0001-retry.txt \
--allow-style-fallback
Use --overwrite only to replace the prior validated JSON for that batch.
python3 scripts/subtitle_tool.py compose --manifest /path/work/manifest.json
The script merges validated data by stable subtitle ID, independent of completion order. It refuses missing, duplicate, or extra IDs and refuses to overwrite output by default. If the output already exists, choose a new --output path or pass --overwrite only when replacing that exact output is intentional.
The final report is written next to the subtitle as <output-path>.report.json, not at the work directory root. For example, SPS.ja.srt has the report SPS.ja.srt.report.json.
Read the final report and tell the user:
The local visualizer is optional. Direct CLI-only use remains available when an Agent is invoking the deterministic tool without a visualizer session. The Web interface is display-only: it never accepts subtitle files, target languages, or translation controls. The Agent remains the only task input and execution surface.
The visualizer listens on 127.0.0.1 by default and stores task history outside the repository under ~/.agent-subtitle-translator/visualizer.
Install the service once, then check for a reusable instance before starting it:
npm install
curl -fsS http://127.0.0.1:4317/api/health
# Run this only when the health check fails:
# npm run visualizer:start
Reuse the existing instance when /api/health returns HTTP 200 with status: "ok", service: "subtitle-visualizer", and a version compatible with this Skill (1.1.1 for this release); open its URL only when the visualizer is requested and skip npm run visualizer:start. If the health request fails or reports an incompatible version, start the service only after addressing the occupied port. If the port responds with another service, report the conflict and use a different port or resolve it deliberately; do not terminate an unknown process automatically.
The visualizer does not call a translation model and keeps the deterministic safety contract; all task inputs and real translation stages come from the Agent through the bridge:
npm run visualizer:bridge -- identify \
--agent "Agent name" \
--model "Model name" \
--model-version "5.6" \
--model-series "Sol" \
--reasoning-strength "high"
npm run visualizer:bridge -- create \
--input /path/movie.ass \
--target-language zh-Hans \
--source-language en
npm run visualizer:bridge -- batch-start --task TASK_ID --batch 1
# Send the complete batches/batch-0001.txt prompt to the available translation model.
npm run visualizer:bridge -- submit-response \
--task TASK_ID \
--batch 1 \
--response /path/responses/batch-0001.txt
npm run visualizer:bridge -- compose --task TASK_ID
Bridge composition refuses to overwrite an existing subtitle or report by default. Use a new --output path for a separate result, or pass --overwrite only when intentionally replacing the exact existing pair:
npm run visualizer:bridge -- compose --task TASK_ID --overwrite
The report path returned by bridge composition is <output-path>.report.json, alongside the generated subtitle.
If validation fails, report the failure in the Web task, retry with the original prompt and the validator error, then submit the retried response. Use retry-batch --task TASK_ID --batch 1 before sending the retry. Use --allow-style-fallback only after the required retry and only when the remaining problem is an ASS S marker mismatch.
Run identify at the beginning of the visualizer session. The session line shows the reported Agent, each task card shows the model recorded for that task, and the program metadata line separately shows the shared program and Skill version read from package.json. Pass the complete model identifier in --model whenever the Agent knows it, such as GPT-5.6 Luna Hight; pass --model-version, --model-series, and --reasoning-strength when those fields exist, such as GPT + 5.6 + Sol + high. Older or other models may omit any optional field, and the Web page omits missing fields. Never invent a version, series, or reasoning value that the Agent cannot verify. Keep reporting the same progress in the Agent response after every meaningful bridge operation.
The Web interface supports multiple Agent-created tasks at once. The left queue shows each task and its overall status; the selected task shows batch progress, per-task and per-batch duration, visible subtitle text, validation/retry/degradation warnings, and the live event stream. The interface never displays the manifest, accepts task input, or sends timestamps and raw ASS override tags to the model.
The Agent must continue reporting progress in its own response while the Web page is open. Web events do not replace Agent output. At minimum, report:
Keep these updates concise and synchronized with the bridge calls so the user can follow the same run in the Agent and in the Web page.
\N/\n to movable BR markers, then restore validated structure.\k, \K, \kf, or \ko individually to static text. Preserve the base Style/event fields and safe whole-line positioning while removing syllable timing and inapplicable animation.<stem>.<normalized-BCP47>.<ext>, such as movie.zh-Hans.srt or movie.pt-BR.ass.manifest.json, timestamps, or raw ASS override tags to the translation model.