| name | experiment-report |
|---|---|
| description | Write Chinese university lab reports and course-design reports, or fit report content into WPS, Word, or docx templates. Use in Codex, OpenClaw, or other local agent workflows when the user asks for an experiment report, lab report, course design report, experiment summary, screenshot insertion, captions, PDF preview, or template filling from topics, requirements, code, data, tutorial pages, screenshots, or results. |
- The user asks to write or complete an experiment report from zero.
- The user asks for a course design report that follows a fixed school-style structure.
- The user has a blank WPS, Word, or docx template and wants it filled.
- The user provides an experiment title, requirements, screenshots, code, data, outputs, or conclusions and wants a report draft or filled report.
- The user provides a tutorial article or CSDN page as the main procedural reference.
- Collect the minimum useful inputs:
- course name
- experiment name
- template path or screenshots if formatting matters
- experiment requirements or task description
- actual steps, code, screenshots, outputs, data, or conclusions
- whether the user wants a factual report or a clearly labeled sample version
- If the user already provides enough facts to write the report body, do not stop to ask for optional metadata such as name, class, date, or template files.
- For a DOCX or other template-controlled deliverable, if the user has not said whether a preferred template exists, ask once:
你有老师、学校或自己认可的优秀 DOCX/DOC 模板吗?有的话请上传,我会优先保持原格式;没有的话,我会从十套不含学校标识的内置模板中选择。 - Do not ask this template question when the user only wants report-body text. Do not ask it again after the user says no, chooses an internal template, or provides a template.
- Write the full report content before touching template formatting.
- If critical facts are missing, do not fabricate exact data, screenshots, or measurements.
- If a local docx template exists and shell execution is available, run
scripts/analyze-docx-template.ps1 -TemplatePath <template.docx>first. Usescripts/extract-docx-template.ps1 -Path <template.docx>when a readable outline is also useful. If the user has no template, runpython -m universal_report select-template --repo-root <repo> --report-type <type> --course <course>or choose from the ten entries inexamples/report-templates/catalog.json. - Treat the generated
TemplateStyleContractand extracted structure as the source of truth. The contract includes effective style inheritance, page setup, title/body/caption roles, table geometry, headers, footers, sections, image placeholders, and structural risks. - If a template exists, adapt the finished content to the template order and field names.
- If the user explicitly wants a filled local docx output and the template matches common report patterns, generate a field map with
scripts/generate-docx-field-map.ps1and then runscripts/apply-docx-field-map.ps1.- Use label keys for normal blank-field filling.
- Use
paragraphsarrays for section-body content. - Use
mode: "after"when the template keeps a fixed heading paragraph and the actual content should go into the following blank paragraph. - Use location keys such as
P2orT1R1C2only when explicit overwrite is needed.
- If the user also provides screenshots or experiment photos and wants them embedded into the final docx, prefer
scripts/generate-docx-image-map.ps1on the filled copy and then runscripts/insert-docx-images.ps1. - Preserve user-template formatting by default. Run
scripts/format-docx-report-style.ps1only when there is no user template, or when the user explicitly asks for normalization or a repository style profile. - Prefer content-first completion over fragile GUI wandering.
- If screenshots are provided, treat them as factual evidence and layout assets.
- If a tutorial page is provided, treat it as procedural reference and rewrite it into report-style Chinese instead of copying it.
- When a local workflow should fetch tutorial references before generation, prefer
scripts/prepare-report-prompt.ps1with-ReferenceUrlsor-ReferenceTextPaths. - When the user provides local file paths in a direct chat workflow, inspect those files first if tool access is available; if a path cannot actually be opened, explicitly say which path was inaccessible instead of pretending it was read.
- When the user asks for a final local
docxresult and the required paths are already present, prefer finishing the end-to-end local workflow over stopping at a body-only draft. - On Windows PowerShell, do not chain shell commands with
&&; use separate executions or;so the command remains valid in legacy PowerShell hosts. - When intermediate JSON or text files contain Chinese paths, captions, or section names, prefer writing them through PowerShell with explicit UTF-8 encoding or through the bundled scripts; do not rely on generic editor-style writes that may corrupt non-ASCII content.
- When direct chat already has a template path, screenshots, identity metadata, and either a finished report body or tutorial references, prefer the one-shot local wrapper
scripts/build-report-from-feishu.ps1over ad-hoc multi-step shell orchestration. - If direct chat includes uploaded image attachments and the user also provides local image paths, use the uploaded images to understand the visible content and use the local image paths as the actual files for deterministic
docxembedding. - If direct chat includes uploaded image attachments but no manual local image paths, check whether the runtime injected attachment note lines such as
[media attached ...]into the prompt. If those lines contain usable image file paths, extract them and pass them into-ImagePathsfor the local wrapper instead of stopping at body-only output.
- A user-supplied DOCX template has the highest formatting priority. Default to
-TemplateStyleMode preserve; do not replace its page setup, fonts, paragraph spacing, title hierarchy, tables, borders, headers, footers, sections, or caption style with repository defaults. - A user upload always wins over a selected internal template. Do not blend the uploaded template with an internal design.
- When no user template exists, choose exactly one of the ten catalog entries:
neutral-classic-lab,neutral-bordered-lab,neutral-engineering-lab,neutral-course-design,neutral-modern-minimal,neutral-compact-header-lab,neutral-review-panel-lab,neutral-code-notebook-lab,neutral-data-analysis-lab, orneutral-project-dossier. Use-BuiltInTemplateIdfor local wrappers when the choice is explicit. - Prefer
neutral-code-notebook-labfor programming, algorithm, code, test, and debug experiments;neutral-data-analysis-labfor measurement, statistics, raw-data, and error-analysis work;neutral-compact-header-labfor short weekly records; andneutral-review-panel-labwhen teacher comments, score, or signature fields are required. - Prefer
neutral-engineering-labfor computer-network, operating-system, database, Web, Android, and software-engineering experiments. Preferneutral-project-dossierfor long-form system projects andneutral-course-designfor ordinary course-design reports. Otherwise default toneutral-classic-lab; use the bordered or modern template when the requested visual direction calls for it. - Internal templates must pass
python -m universal_report audit-template-catalog --repo-root <repo>. They may not contain real school/college names, logos, watermarks, example student identities, embedded third-party media, or copied sample report content. - Treat the internal DOCX files as original neutral reconstructions under the repository license. Public templates and GitHub projects are design references only; do not copy their branding, sample text, media, or restricted assets into the internal files.
- Before rendering, create or reuse a
TemplateStyleContract. After rendering, runscripts/validate-docx-format.ps1and report the exact failed contract items instead of saying only that formatting is wrong. - Use
-TemplateStyleMode normalize -StyleFinalDocxonly for the repository default template, demo output, or an explicit user request to unify styling. - Default image layout is one image per line with a concrete caption below it. Preserve aspect ratio, keep the image and caption together when practical, and use row/grid layouts only when explicitly requested.
- Honor an exact requested image count. Deduplicate by content hash and record selected, rejected, and duplicate files plus selection reasons in
image-manifest.json; never duplicate an image merely to reach the count. - Course-design flowcharts, generated structure tables, large fixed image widths, and other profile enhancements are allowed only for a default/normalized template. Do not inject them automatically into an unrelated user template.
- Fast mode must still run structural, layout, and format validation. Strict mode must export DOCX to PDF, render every page, and run visual checks; if that chain cannot complete, return
needs-fixrather than success. - LibreOffice is the preferred PDF converter. WPS/Microsoft Word COM is opt-in only, must have a timeout, and may clean up only Office processes started by the current automation run.
- Keep these rules scoped to structured experiment and course-design reports. Do not claim support for arbitrary office documents whose template structures have not been analyzed.
- Use clear Chinese suitable for university reports.
- Keep claims consistent with the provided requirements, code, data, screenshots, and outputs.
- Avoid empty filler and generic AI phrasing.
- If the user provides the course name or experiment name, write them explicitly into the final report instead of assuming the surrounding chat context is enough.
- If the user already supplied the experiment topic, environment, steps, results, and required headings, write the report immediately instead of asking for more materials.
- Ask follow-up questions only when missing facts would make the result materially wrong, or when the user explicitly wants template filling but no template is available.
- If the user only wants the report body, missing personal identity fields must not block generation.
- If direct chat is being used with local file paths, avoid optimistic assumptions about file access; either read the files or clearly state that file access was not available.
- When the experiment is software-related, include environment, implementation steps, results, analysis, and conclusion.
- When the template has fixed headings, preserve them exactly.
- If webpage instructions and user screenshots differ, trust the user screenshots and outputs.
- If both uploaded image attachments and local image paths are available, use the attachments as the semantic reference for what each image shows, but use the local paths for the final
docximage insertion workflow. - If uploaded image attachments are present without manual local paths, prefer the prompt-injected attachment paths from
[media attached ...]notes as theImagePathsinput forscripts/build-report-from-feishu.ps1orscripts/generate-docx-image-map.ps1. If the runtime does not expose any real attachment path, say that clearly instead of pretending directdocxinsertion succeeded. - When screenshots are provided without explicit grouping, infer
实验环境,实验步骤,实验结果, or问题分析from filenames and visible content, but do not invent unseen details. - If a local workflow needs temporary JSON such as field maps or image maps and those files include Chinese text, write them in explicit UTF-8 and retry from that stage if parsing fails.
- Default: final report content with headings ready to paste.
- Template mode: exact field-to-content mapping in template order.
- Template mode can include block values such as
{"section-body": ["paragraph one", "paragraph two"]}when the template body has multi-paragraph sections. - Image mode: when screenshots should be embedded into a docx, prefer image specs or an image insertion map that can be passed to
scripts/generate-docx-image-map.ps1orscripts/insert-docx-images.ps1. Stable section anchors such as实验步骤or实验结果are preferred over fragile paragraph numbers when the filled docx may add or move paragraphs. - Completion mode: if the user explicitly asks to complete the template, first finish the content, then attempt template filling only if tooling is actually available.
- For local docx templates, run
scripts/extract-docx-template.ps1to capture the actual field order before producing a field mapping. - For local docx templates that should be machine-filled, run
scripts/generate-docx-field-map.ps1after the report body is ready, then runscripts/apply-docx-field-map.ps1. - For local screenshots or experiment photos that should be embedded into the filled docx, prefer
scripts/generate-docx-image-map.ps1first and then runscripts/insert-docx-images.ps1on the already-filled copy. - For a cleaner normalized copy, optionally run
scripts/format-docx-report-style.ps1only when the user explicitly wants repository styling or no user template exists. - Use
scripts/plan-report-content.ps1to create a structured content plan before body rendering when materials come from multiple sources. - Use
scripts/analyze-docx-template.ps1andscripts/validate-docx-format.ps1for template-contract analysis and post-render fidelity checks. - Use
scripts/run-visual-validation.ps1for strict PDF and per-page preview validation. - Use
python -m universal_report list-templates --repo-root <repo>to show the five internal options,select-templateto select one, andaudit-template-catalogto enforce neutrality and provenance. - For chat-driven local execution, prefer
scripts/build-report-from-feishu.ps1so the wrapper can keep the final deliverable in the output root and move intermediate files into anartifacts/subdirectory. - The image pipeline can resolve staged relative attachment paths such as
media/inbound/example.pngfrom OpenClaw-style prompts; when those paths appear in prompt-injected media notes, reuse them directly in-ImagePaths. - When the template has fixed section headings plus blank paragraphs, prefer block mappings over flattening long body content into a single field.
- For public tutorial pages, prefer
scripts/fetch-web-article.ps1; keepscripts/fetch-csdn-article.ps1as the compatibility wrapper for CSDN-specific workflows. - When a tutorial page should flow directly into report generation, prefer
scripts/prepare-report-prompt.ps1so the extracted reference text is appended to the final request deterministically. - The helpers are optional. If they are unavailable, still finish the report from the information already provided.
- Read
references/common-structures.mdwhen choosing a report outline. - Read
references/template-fit.mdwhen the user provides a WPS, Word, or docx template path or template screenshots. - Read
references/image-handling.mdwhen the user provides experiment screenshots or process images.