Fill Due Diligence Report
Use this skill to create a local AI draft for Chinese due-diligence questionnaires and material forms. First-version scope is local DOCX/XLSX only.
Scope
- Reference library:
D:\DueDiligence\materials. - Main facts:
D:\DueDiligence\materials\信息库. - Historical examples:
D:\DueDiligence\materials\案例\人工版. - Blank templates:
D:\DueDiligence\materials\案例\尽调问卷or a user-provided path. - Information-library indexes:
D:\DueDiligence\cache\info_library_directory.json,D:\DueDiligence\cache\info_library_chunks.json, andD:\DueDiligence\cache\info_library_sections.json. - Outputs:
D:\DueDiligence\outputs\<task-name>unless the user gives another folder. - Do not collect, package, upload, or validate attachment files in first version.
- Do not process web questionnaires in first version.
- Do not OCR scanned PDFs in first version.
Required References
- Read
references/answer_rules.mdbefore drafting answers. - Read
references/comment_policy.mdbefore writing answer-map comments. - Read
references/local_mvp_workflow.mdbefore running the workflow.
Default Workflow
- Generate or refresh the case manifest:
powershell
python scripts\case_manifest.py --materials-root D:\DueDiligence\materials --out D:\DueDiligence\cache\case_manifest_v1.json
- Ensure the information-library index exists. Reuse the existing cache by default. Generate or refresh it only on first use, after the Word information library changes, or when the user asks to refresh:
powershell
python scripts\build_info_library_index.py --materials-root D:\DueDiligence\materials --out-dir D:\DueDiligence\cache
-
Choose an editable
.docxor.xlsxtemplate. If a template is inside a.zipor.rar, extract only the editable template into the task output folder and leave attachments alone. -
Build the AI semantic field review packet from the code-parsed template structure:
powershell
python scripts\template_inspector.py --template <template-path> --out <output-folder>\template_fields_raw.json
python scripts\semantic_template_fields.py prepare --raw-fields <output-folder>\template_fields_raw.json --out-dir <output-folder> --institution <机构> --product <产品> --strategy <策略>
Codex must read <output-folder>\template_semantic_review_packet.json and edit <output-folder>\template_fields_semantic_template.json, saving the reviewed result as <output-folder>\template_fields_semantic.json.
The reviewed JSON must set semantic_review_status to reviewed, reviewed_by to Codex, and include review_notes.
The AI semantic pass must preserve original writeback targets for kept fields, exclude directories/page numbers/examples/instructions/attachment-only requirements/fixed headers, merge complex fillable tables into table_region fields where appropriate, classify field roles, and mark sensitive or dynamic fields as review_required.
Do not build the task pack until this Codex-reviewed semantic file exists. Raw code-parsed fields are only allowed for parser debugging with the explicit --allow-raw-fields flag.
- Build the task pack:
powershell
python scripts\run_task.py --template <template-path> --output <output-folder> --institution <机构> --product <产品> --strategy <策略> --materials-root D:\DueDiligence\materials --cache-dir D:\DueDiligence\cache --semantic-fields <output-folder>\template_fields_semantic.json
This reuses D:\DueDiligence\cache\info_library_directory.json, D:\DueDiligence\cache\info_library_chunks.json, and D:\DueDiligence\cache\info_library_sections.json when present. It creates template_fields_raw.json from code parsing, writes AI semantic review helper files, requires the Codex-reviewed template_fields_semantic.json to create the final template_fields.json, creates field_evidence.json by matching the final semantic fields against indexed headings/chunks, then creates resolved_evidence.json by fetching the matched complete sections from info_library_sections.json. Add --refresh-index only when the information-library Word file has changed and the cache should be rebuilt.
It also creates answers_draft.json, a conservative evidence-based draft generated from answer_map_template.json and resolved_evidence.json.
- Read:
<output-folder>\task_context.md<output-folder>\template_fields_raw.json<output-folder>\template_semantic_review_packet.json<output-folder>\template_fields_semantic_template.json<output-folder>\template_fields_semantic.json<output-folder>\template_fields.json<output-folder>\template_extraction_report.md<output-folder>\answer_map_template.json<output-folder>\answers_draft.json<output-folder>\field_evidence.json<output-folder>\resolved_evidence.jsonD:\DueDiligence\cache\info_library_directory.jsonD:\DueDiligence\cache\info_library_chunks.jsonD:\DueDiligence\cache\info_library_sections.json- source materials and relevant historical manually-filled cases under
D:\DueDiligence\materials
- Review
answers_draft.jsonand save the reviewed final mapping asanswers.json.
answers_draft.json is generated conservatively: scalar key-value fields may be filled from evidence, and narrative prompts such as introductions of systems, processes, teams, or controls may be drafted by extracting relevant fragments from resolved evidence. Dynamic, sensitive, weak, missing, or complex table fields are marked for review or missing. Use resolved_evidence.json first. Each filled answer must be grounded in a resolved section and must include evidence_refs. Narrative composed answers must include supporting_fragments copied from the referenced evidence. Do not mark a field missing before checking field_evidence.json and resolved_evidence.json. If evidence is weak, synthesized, dynamic, conflicting, or sensitive, use review instead of unsupported filling.
Check template_extraction_report.md for parser confidence and field roles. paragraph_inline fields represent inline blanks such as 管理人名称:____ and are written back in place. When a numbered section heading such as (一)公司基本情况 is immediately followed by a table, treat the heading as table context only; do not create a separate paragraph answer for the heading. table_region fields represent complex tables such as股权结构、团队人员、产品明细等; automatic drafting marks them for review by default, but DOCX filling supports manually reviewed structured row answers.
For each answer, include:
target: keep the original target object unchanged.answer: the draft answer, or empty string when information is missing or must be left blank.status: one offilled,missing, orreview.comment.kind:source,missing, orreview.comment.text: concise inline review note for the business reviewer.comment.author:AI初稿.evidence_refs: forfilledanswers, at least one object withfield_idandsection_idfromresolved_evidence.json.supporting_fragments: for composed narrativefilledanswers, source fragments copied from the referenced evidence.
- Validate evidence grounding before generating the AI draft:
powershell
python scripts\validate_answers.py --answers <output-folder>\answers.json --resolved-evidence <output-folder>\resolved_evidence.json
If validation fails, fix answers.json; do not generate the final DOCX/XLSX from unsupported answers. Final answers.json must not contain draft statuses, and each filled answer must be supported by the referenced evidence text directly or by supporting_fragments.
- Generate the AI draft with inline comments:
powershell
python scripts\fill_docx.py --template <template-path> --answers <output-folder>\answers.json --out <output-folder>\<name>-AI初稿.docx
python scripts\fill_xlsx.py --template <template-path> --answers <output-folder>\answers.json --out <output-folder>\<name>-AI初稿.xlsx
- Verify comment wiring:
- DOCX: use
scripts.docx_comments.inspect_docx_commentsor inspect the ZIP structure forword/comments.xml. - XLSX: open with
openpyxland confirm target cells have comments.
Drafting Rules
- Preserve the user's template structure. Do not rewrite headings, field names, tables, sheets, or ordering.
- Base filled answers on
resolved_evidence.json. Do not invent dates, numbers, codes, product data, staff counts, legal facts, compliance facts, or wording that is not supported by resolved evidence. - Use historical manually-filled cases as style and mapping guidance, not as unquestioned truth.
- If a field cannot be supported, leave the answer empty and add a
[缺失]comment. - Product performance, NAV, returns, drawdown, win rate, latest scale, and other dynamic performance fields must be empty or marked
[复核]for manual completion. - For
table_regionDOCX targets, use a structured row list when manually filling, for example[{"股东名称":"张三","出资比例(%)":"10%"}]. - Use formal, neutral, conservative Chinese. Avoid marketing claims and return promises.
Output Contract
The business-facing deliverable is the edited DOCX/XLSX AI draft with inline comments. Keep JSON files and task context in the output folder for audit/debugging, but do not ask business reviewers to review separate source/missing/low-confidence Markdown files.