Drafting Requirements and Design Documents for Code Security Auditing: Multi-turn Dialogue and Prompt Words

Code security audit data primarily comes from project source code repositories, third-party dependency lists, static application security testing

What the data for this category looks like

Code security audit data primarily comes from project source code repositories, third-party dependency lists, static application security testing (SAST) tool outputs, and public vulnerability databases. Data is refreshed with project version iterations or upon completion of a single audit task. Documents covered in a single audit include code audit reports, vulnerability proof materials, repair recommendation documents, and retest records. A single audit document typically includes fields such as vulnerability severity, dangerous function location, attack path description, and dependency package version information. There is no unified fixed unit; values change dynamically based on the code size of the audit target and the number of dependencies.

Since data sources include multiple types of tool outputs and manual retest records, multi-turn dialogue must support gradual integration of audit information from different dimensions to avoid bias from a single data source. Data updates rapidly with project versions, so prompt words must include guiding logic to dynamically adapt to the latest vulnerability databases and code changes. Audit documents have diverse fields and no fixed units, so multi-turn dialogue must support flexible extraction of associated information from different fields. It must also adapt to step-by-step questioning logic for time-consuming links such as dangerous function location and data flow tracking, to ensure coverage of the complete audit chain.

How to Configure

This configuration applies to FastGPT v4.17.0:

Configuration ItemRecommended SettingRationale
Context window upper limit8000–12000 tokenAdapts to the long text characteristics of code audit documents, avoiding truncation of key information such as vulnerability descriptions and code snippets
messages history turn limitFirst 12–18 dialogue turnsBalances context completeness and response latency, aligns with the multi-turn questioning rhythm of a single audit task
variables global audit parametersAudit project ID, current vulnerability database versionUsed to pass fixed audit context, reducing operational costs of repeated input
chatId session binding ruleBind the unique identifier of the current audit projectEnsures multi-turn dialogue context for the same project is not confused with other projects
Multi-turn dialogue timeout600 secondsAdapts to analysis requirements for time-consuming links such as dangerous function location and data flow tracking

Three Common Misconfigurations

  • Symptom: Empty data or status code 500 is returned after calling the code security audit dialogue interface. Cause: chatId is not correctly bound to the unique identifier of the current audit project, causing context to fail to load.
  • Symptom: After triggering a short-text audit question, the system returns the full result directly before switching to streaming output. Cause: The messages history turn limit is not configured, causing the system to not process the request according to step-by-step questioning logic.
  • Symptom: Code audit output content cannot be obtained into dialogue variables in the workflow. Cause: Audit results are not bound to the global context via the variables parameter, causing the variables to fail to be recognized.

How to Verify Proper Configuration

  • Manually initiate a short-text audit question, check if the response is output step-by-step according to multi-turn dialogue logic.
  • View session logs to confirm that chatId matches the unique identifier of the current audit project.
  • Call the interface with the variables parameter, check if fixed audit project parameters can be passed correctly.
  • Test long-text input to confirm that the context window does not truncate key audit information.

The values provided are common starting points and should be measured against the reader's own samples.

Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-10-19.