Skip to content

Template Files and Generated Artifacts

Templates and Guide_Doc are inputs to stage tasks. They instruct the Agent on what to generate, the format to use, and which conditions the Checker will verify; they themselves are not test results and cannot replace the Checker or test evidence.

Relevant Directories in the Workspace

Using output/ as the workspace and the explicitly selected UnitTest workflow output directory unit_test/ as an example:

1
2
3
4
5
6
7
output/
├── <DUT>/                  # DUT source code, README, and input materials
├── Guide_Doc/              # Runtime-copied guidance documents
├── unit_test/             # Documents, tests, and coverage definitions generated by the workflow
│   └── tests/              # pytest/toffee test files
├── uc_test_report/         # Reports generated by test tools (if tests are run)
└── .ucagent/               # Runtime configuration snapshots, history, and state

The --output flag can change the directory name of unit_test/. Specific files are determined by the current stage's configuration, template, and Checker, so do not treat the complete file tree from a single example as the fixed output for all workflows.

Differences Between Guide_Doc and Templates

Guide_Doc

Files in Guide_Doc/ are runtime reference materials, typically sourced from the selected workflow plugin or a custom --guid-doc-path. A stage can declare required files via reference_files; before the Complete state is reached, the stage's reference files and output files must satisfy the gate. A --guid-doc-path directory supplies the base document set (the last directory takes effect); file arguments append by filename. Plugin documents are composed with that set under the configured copy policy.

Guide_Doc should clearly specify:

  • The objective of the current stage, available inputs, and allowed write paths;
  • The complete format, field order, tags, and evidence requirements of the artifacts;
  • A complete reference example from title to end;
  • How to check inputs, fix artifacts, and re-call Check upon failure.

Runtime paths are always relative to the workspace. For example, when referencing a file in a prompt, write Guide_Doc/dut_test_case.md section 3, not the absolute path of this repository.

Generation Templates

Templates are initial files copied or rendered into the workspace. The selected workflow supplies its template directory; custom templates can use --template-dir, and existing targets can be overwritten using --template-overwrite. Template override configuration is passed via --template-cfg-override <yaml>; it handles only template variables and does not alter the stage Checker's judgment rules.

Common Artifacts

The explicitly selected UnitTest workflow typically generates the following categories of content in unit_test/, depending on whether the current stage is enabled:

  • *_basic_info.md, *_verification_needs_and_plan.md: DUT information, verification needs, and plans;
  • *_functions_and_checks.md: FG/FC/CK functional models, referenced by test and coverage definitions;
  • tests/*_api.py, tests/test_*.py: test interfaces, fixtures, and test cases;
  • *_function_coverage_def.py: functional coverage groups, coverage points, and sampling definitions;
  • *_line_coverage_analysis.md: line coverage results and regression analysis (requires corresponding stage configuration);
  • *_bug_analysis.md, *_test_summary.md: bug evidence and test summary (requires corresponding stage configuration).

uc_test_report/ is typically generated by RunUnityChipTest or the project's own Make targets and may include HTML and JSON reports. Only after tests are actually run can pass rates and coverage from the reports be treated as results.

How to Add a Custom Guide_Doc

Create files in the workflow directory, for example:

1
2
3
4
MyWorkflow/
├── Guide_Doc/
│   └── project_analysis_guide.md
└── config.yaml

Declare it in the stage:

stage:
  - name: analyze_project
    desc: "Analyze project"
    reference_files:
      - "Guide_Doc/project_analysis_guide.md"
    output_files:
      - "{OUT}/{DUT}_analysis.md"
    task:
      - "Read Guide_Doc/project_analysis_guide.md"
      - "Write analysis results to {OUT}/{DUT}_analysis.md"

Paths in stage configuration are relative to the workspace; template variables such as {DUT} and {OUT} are replaced after configuration parsing. If a referenced file does not exist, is not read, or an output file is not generated, the stage check will fail and return the paths that need fixing.

Tips for Writing Templates

  1. Define the structure the machine needs to check first, then add explanatory text. Field names, heading levels, and tags must be unique and stable.
  2. Show the true end state in a complete example; do not provide only fragments and let the Agent infer missing sections.
  3. Clearly specify when optional branches are used, avoiding normal results like "no bugs" or "no coverage data" being mistakenly written as failures.
  4. Templates describe only the current contract. When formats change, update Guide_Doc, task prompts, Checker, skill assets, and tests in sync.
  5. Do not place API keys, access tokens, or other secrets in templates; runtime snapshots should only store non-sensitive configurations.

MiniWorkflow Example

The minimal runnable example is located in the repository's examples/MiniWorkflow. It includes:

  • Guide_Doc/: stage reference documents;
  • mini.yaml: definition of two stages, tools, and Checker;
  • my_tools.py and my_checkers.py: extended implementations;
  • Makefile: prepares output/ and launches UCAgent.

Read Custom Development Quick Start first, then run the Mini Example. For modifying tools or Checker, refer to Customizing Tools and Checkers respectively.