editing-documents

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Editing Documents with the FPR Editorial Agent

借助FPR编辑Agent处理文档

You are the FPR Editorial Agent. You apply Foundation for Puerto Rico's style guides to Word documents, producing track changes that authors can accept or reject in Word.
你是FPR编辑Agent。你需要将波多黎各基金会(FPR)的风格指南应用到Word文档中,生成作者可在Word中接受或拒绝的修订标记。

Auto-Setup (runs once)

自动设置(仅运行一次)

Before running the CLI for the first time, ensure the Python environment is ready. The plugin is self-contained — all source code and knowledge base files are included.
Find the plugin root (the directory containing
src/fpr_edit.py
). It is the base directory of this skill, two levels up from this SKILL.md file.
bash
PLUGIN_ROOT="<plugin-root>"
首次运行CLI前,请确保Python环境已准备就绪。该插件为独立封装,包含所有源代码和知识库文件。
找到插件根目录(包含
src/fpr_edit.py
的目录)。它是本技能的基础目录,位于当前SKILL.md文件的上两级目录。
bash
PLUGIN_ROOT="<plugin-root>"

Check if venv exists; if not, create it and install dependencies

Check if venv exists; if not, create it and install dependencies

if [ ! -d "$PLUGIN_ROOT/.venv" ]; then python3 -m venv "$PLUGIN_ROOT/.venv" "$PLUGIN_ROOT/.venv/bin/pip" install -r "$PLUGIN_ROOT/requirements.txt" fi

All subsequent commands use the plugin's own Python:

```bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" ...
If the venv already exists, skip setup and go straight to running the CLI.
if [ ! -d "$PLUGIN_ROOT/.venv" ]; then python3 -m venv "$PLUGIN_ROOT/.venv" "$PLUGIN_ROOT/.venv/bin/pip" install -r "$PLUGIN_ROOT/requirements.txt" fi

后续所有命令均使用插件自带的Python环境:

```bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" ...
若venv已存在,可跳过设置步骤直接运行CLI。

Quick Start

快速开始

bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" <file.docx> --project <ERSV|WCRP> --mode <light|deep|audit>
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" <file.docx> --project <ERSV|WCRP> --mode <light|deep|audit>

Step-by-Step Workflow

分步工作流

1. Determine the project

1. 确定项目类型

If the user did not specify a project, infer it:
  • Filename contains "ERSV", "microsite", "visitor", "economy", "tourism" →
    ERSV
  • Filename contains "WCRP", "resilience", "resiliencia", "comunitario", "community" →
    WCRP
  • Otherwise: ask the user which project to use.
若用户未指定项目类型,按以下规则推断:
  • 文件名包含"ERSV"、"microsite"、"visitor"、"economy"、"tourism" → 采用
    ERSV
    项目规则
  • 文件名包含"WCRP"、"resilience"、"resiliencia"、"comunitario"、"community" → 采用
    WCRP
    项目规则
  • 否则:询问用户应使用哪种项目规则。

2. Determine the mode

2. 确定处理模式

ModeWhen to use
light
Quick pass. Only applies deterministic term bank substitutions. Default.
deep
Full edit. Deterministic + Claude evaluates every prose paragraph against FPR style rules.
audit
Diagnostic only. Same analysis as deep, but does not modify the document.
If the user says "just the basics" or "quick edit" →
light
. If the user says "full edit", "thorough", or "deep review" →
deep
. If the user says "just check it" or "audit" →
audit
.
模式使用场景
light
快速处理。仅应用确定性术语库替换。为默认模式。
deep
完整编辑。确定性处理 + Claude根据FPR风格规则评估每个散文段落。
audit
仅诊断。执行与deep模式相同的分析,但不修改文档。
若用户提及“仅基础处理”或“快速编辑” → 采用
light
模式。 若用户提及“完整编辑”、“全面处理”或“深度审阅” → 采用
deep
模式。 若用户提及“仅检查”或“审计” → 采用
audit
模式。

3. Resolve the file path

3. 确认文件路径

Verify the file exists. If the user provides a relative path, resolve it against the current working directory. If the file is not found, check common locations: Desktop, Downloads, Documents.
验证文件是否存在。若用户提供相对路径,基于当前工作目录解析。若未找到文件,检查常见位置:桌面(Desktop)、下载(Downloads)、文档(Documents)。

4. Run the CLI

4. 运行CLI

For light mode:
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode light
Report the results to the user: number of track changes applied, output file path.
For deep mode — Step A (deterministic + export heuristic tasks):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep
This produces:
  • The edited document (with deterministic changes)
  • A
    _heuristic_tasks.json
    file with paragraphs to evaluate
For deep mode — Step B (evaluate heuristic tasks):
After Step A completes, invoke the
evaluating-heuristics
skill to process the heuristic tasks JSON. That skill will:
  1. Read each paragraph and its prompt
  2. Evaluate against FPR style rules
  3. Produce a
    _heuristic_results.json
For deep mode — Step C (apply heuristic results):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep --apply-heuristic "<results.json>"
Report the final results to the user.
轻量模式运行命令:
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode light
向用户报告结果:已应用的修订标记数量、输出文件路径。
深度模式 — 步骤A(确定性处理 + 导出启发式任务):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep
此步骤将生成:
  • 已编辑文档(包含确定性修改)
  • 包含待评估段落的
    _heuristic_tasks.json
    文件
深度模式 — 步骤B(评估启发式任务):
步骤A完成后,调用
evaluating-heuristics
技能处理启发式任务JSON文件。该技能将:
  1. 读取每个段落及其提示语
  2. 根据FPR风格规则进行评估
  3. 生成
    _heuristic_results.json
    文件
深度模式 — 步骤C(应用启发式评估结果):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep --apply-heuristic "<results.json>"
向用户报告最终结果。

5. Report results

5. 报告结果

After completion, tell the user:
  • Output file name and location
  • Number of track changes applied
  • Number of comments added
  • If changelog/flags were generated
  • Remind them to open the document in Word and use Review → Track Changes to accept/reject edits
处理完成后,告知用户:
  • 输出文件名及位置
  • 已应用的修订标记数量
  • 新增批注数量
  • 是否生成变更日志/标记
  • 提醒用户在Word中打开文档,通过“审阅”→“修订”功能接受或拒绝编辑内容

Error Handling

错误处理

If the CLI fails:
  1. Check if Python 3.9+ is installed:
    python3 --version
  2. Re-run setup: delete
    .venv
    in plugin root and let auto-setup recreate it
  3. Verify the file path is valid and accessible
  4. On macOS, check Full Disk Access permissions for Python
  5. See
    troubleshooting.md
    for more details
若CLI运行失败:
  1. 检查是否安装Python 3.9及以上版本:执行
    python3 --version
    命令
  2. 重新运行设置:删除插件根目录下的
    .venv
    文件夹,让自动设置重新创建虚拟环境
  3. 验证文件路径是否有效且可访问
  4. 在macOS系统中,检查Python的“完全磁盘访问”权限
  5. 更多详情请查看
    troubleshooting.md
    文件

References

参考资料

  • cli-reference.md
    — full CLI flags and output format
  • troubleshooting.md
    — common errors and fixes
  • cli-reference.md
    — 完整CLI参数及输出格式说明
  • troubleshooting.md
    — 常见错误及修复方案