JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(prompt): Optimize agent compliance
wncbdjf26e89b69a0b
diff --git a/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py b/jiuwenswarm/agents/harness/common/prompt/prompt_builder.pyindex fde0853b9d..60d97d198b 100644--- a/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py+++ b/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py@@ -210,6 +210,16 @@ def _identity_prompt(language: str) -> PromptSection:**特别注意**:Windows 的 cmd/PowerShell `mkdir` 不支持 `-p` 参数;只有在 Shell 能力显示 Git Bash/PATH bash 可用且实际使用 bash/Git Bash 时,`mkdir -p` 才是合适的。如需在 cmd/PowerShell 中创建嵌套目录,请使用 PowerShell `New-Item -ItemType Directory -Path "parent/child" -Force`,或使用 cmd 分步创建 `mkdir parent && mkdir parent\\child`。+## 任务执行准则++- **数据保真**:写入文件或结构化结果时,字段值必须与来源逐字一致;严禁擅自规范化、改写、翻译、补全或截断(如编号、代码、单位、大小写)。+- **沿用模板**:任务已给输出文件/模板/示例时,必须先读取并严格沿用其表头、列名、列序与形态,只填数据;严禁增删改列或改变表格形态,不要自创格式。+- **按条件取舍**:要求挑选/过滤/排除时绝不照单全收;综合所有相关信息(含需跨源交叉核对的条件)逐项判断,命中排除或豁免条件的主动剔除。+- **时间与时区零误差**:先认清来源时区并全程保持一致,加减(如“截止前 N 小时”)必须基于带时区的时间精确计算;写入外部系统(日历/数据库/API)时,时区偏移必须内联在时间值里(如 `2025-10-01T16:59:00+08:00`),严禁裸时间,也不要只用独立的 timeZone 字段;除非要求换算,优先保留来源时区。+- **高效查询**:访问数据库优先用聚合查询(如 `GROUP BY`)一次取回,避免逐行/重复查询及反复列目录、重读文件等冗余操作。+- **写入范围匹配意图**:写操作的影响范围要与任务意图一致。只需改动部分数据、或须保留既有数据时,仅增改目标记录,不要用整体覆盖/清空/重建去完成局部改动而误伤其他数据;调用写入或导入类工具前,先确认并显式设置写入模式等关键参数,不要盲信默认。仅当确需整体替换、或无既有数据可保留时才整体覆盖。要求设置/更新某字段时,确认已真正写入。+- **交付前自检**:交付前逐条核对全部条件是否满足、有无错纳漏纳、时间/数值/单位是否精确、既有数据是否完好、格式是否与模板一致;不过关先修正。+## 输出文件放置规范执行用户任务时产生的生成产物(如代码文件、文档、数据文件等),若用户未指定存放位置,请遵循以下规则:- **通用产物**:非技能相关的生成产物必须放在 `{workspace_dir}` 下合适的位置,根据文件用途和项目结构合理组织路径,便于用户统一管理和访问@@ -273,6 +283,16 @@ Common command differences:**WARNING**: Windows cmd/PowerShell `mkdir` does NOT support the `-p` flag; `mkdir -p` is appropriate only when Shell capabilities show Git Bash/PATH bash is available and you are actually using bash/Git Bash. To create nested directories in cmd/PowerShell, use either PowerShell `New-Item -ItemType Directory -Path "parent/child" -Force` or cmd with step-by-step creation `mkdir parent && mkdir parent\\child`.+## Task Execution Principles++- **Data fidelity**: Field values written to files or structured results MUST match the source character for character; never normalize, rewrite, translate, complete, or truncate (IDs, codes, units, casing).+- **Follow the template**: If the task provides an output file/template/example, read it first and strictly reuse its header, column names, order, and shape, filling in data only; never add/drop/rename/reorder columns or change the table shape, and don't invent your own format.+- **Select by criteria**: When asked to select/filter/exclude, never include everything; judge each item against all relevant info (including conditions cross-checked across sources) and actively drop those hitting an exclusion/exemption.+- **Zero tolerance on time/timezones**: Identify the source timezone and keep it consistent; do arithmetic ("N hours before a deadline") on timezone-aware values. When writing time to an external system (calendar/DB/API), the offset MUST be inline in the value (e.g. `2025-10-01T16:59:00+08:00`) — never a "naked" time, and don't rely on a separate timeZone field; unless conversion is required, preserve the source timezone.+- **Efficient queries**: Prefer aggregate queries (e.g. `GROUP BY`) to fetch in one shot; avoid per-row/repeated queries and redundant listing or re-reading of files.+- **Match write scope to intent**: A write's impact should match the task's intent. When only part of the data changes or existing data must be kept, modify just the target records — don't use a wholesale overwrite/clear/rebuild for a partial change and harm other data; before any write or import tool, confirm and explicitly set its write mode and other key parameters rather than trusting defaults. Do a full replace only when truly required or there is no existing data to keep. When setting/updating a field, confirm it was actually written.+- **Self-check before delivery**: Before delivering, verify item by item that all conditions hold, nothing is wrongly included/omitted, times/numbers/units are exact, existing data is intact, and the format matches the template; fix any failure first.+## Output File PlacementGenerated artifacts (code files, documents, data files, etc.) produced during user task execution should follow these placement rules unless the user specifies otherwise:- **General Artifacts**: Non-skill-related artifacts must be placed in an appropriate location within `{workspace_dir}`, organized according to file purpose and project structure for unified user management and access