Skip to content

feat(agents): add patrol system prompt for autonomous patrol agent#2023

Open
zhangyinxina-ui wants to merge 1 commit into
dimensionalOS:mainfrom
zhangyinxina-ui:worktree-agent-a82e1b055f0c8aa3c
Open

feat(agents): add patrol system prompt for autonomous patrol agent#2023
zhangyinxina-ui wants to merge 1 commit into
dimensionalOS:mainfrom
zhangyinxina-ui:worktree-agent-a82e1b055f0c8aa3c

Conversation

@zhangyinxina-ui
Copy link
Copy Markdown

Adds PATROL_SYSTEM_PROMPT constant for the autonomous patrol LLM agent running on Unitree Go2. Includes prompt definition and 31 unit tests.

Adds PATROL_SYSTEM_PROMPT constant for the autonomous patrol LLM agent
running on Unitree Go2. The prompt defines the agent identity (Daneel),
patrol workflow (prepare, plan route, execute, monitor, report), all
available patrol/navigation/mapping skills, safety instructions, and
anomaly handling guidelines.

Includes 31 unit tests verifying prompt content coverage: all 21 skill
names, key sections (safety, workflow, anomaly handling), workflow steps,
obstacle handling, battery monitoring, and SLAM references.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR adds PATROL_SYSTEM_PROMPT, a Chinese-language LLM system prompt for an autonomous patrol agent running on the Unitree Go2 robot, along with 31 unit tests that verify keyword and section presence in the constant.

  • The prompt defines the agent's identity (Daneel), safety rules, a five-phase patrol workflow, skill references for 21 named tools, and anomaly-handling playbooks for localization loss, obstacles, low battery, and detected anomalies.
  • Two logic gaps exist: the "create new map" preparation step directs the agent to call save_current_map, but no skill to start a fresh mapping session is defined anywhere in the available skill list; and the top-level safety rules only cite the 20% battery stop threshold, omitting the 30% warning tier that appears later in the anomaly guide.

Confidence Score: 3/5

Safe to merge as a string constant, but two logical gaps in the prompt mean the patrol agent will not behave correctly in all advertised scenarios.

The "create new map" preparation step instructs the agent to call save_current_map, yet no skill exists in the listed inventory to actually start a new SLAM mapping session. An agent in an unmapped environment will follow the instruction, save the old map, and then have no viable next step. The battery warning threshold is also missing from the primary safety rules, so the 30% verbal-warning behaviour may not be reliably triggered. Both gaps affect real operational paths that the prompt is intended to cover.

dimos/agents/skills/patrol_system_prompt.py — the preparation workflow and safety rules sections need revision before this prompt is deployed to a live robot.

Important Files Changed

Filename Overview
dimos/agents/skills/patrol_system_prompt.py Adds PATROL_SYSTEM_PROMPT for the Unitree Go2 patrol agent; the "create new map" preparation step references save_current_map but no skill exists to actually start a fresh mapping session, and the battery warning threshold in the safety rules is incomplete.
dimos/agents/skills/test_patrol_system_prompt.py 31 parametrized unit tests verify keyword presence for all 21 skills, key Chinese-language section headings, and workflow steps; coverage is appropriate for a string-constant module.

Sequence Diagram

sequenceDiagram
    participant Op as Operator
    participant Agent as Daneel (LLM Agent)
    participant Skills as Robot Skills
    participant HW as Go2 Hardware

    Op->>Agent: Start patrol command
    Agent->>Skills: check_localization_quality
    Skills-->>Agent: localization quality OK
    Agent->>Skills: list_available_maps / load_saved_map
    Skills-->>Agent: map loaded
    Agent->>Skills: create_patrol_route + add_patrol_waypoint(x,y)
    Agent->>Skills: start_patrol
    loop Each waypoint
        Skills->>HW: navigate to waypoint
        HW-->>Skills: arrived
        Agent->>Skills: observe (photo)
        Agent->>Skills: speak (status update)
        Agent->>Skills: check_localization_quality
        alt Localization lost
            Agent->>Skills: stop_patrol
            Agent->>Skills: speak (notify operator)
        end
        alt Obstacle detected
            Agent->>Skills: stop_navigation
            Agent->>Skills: relative_move (avoid)
        end
        alt "Battery < 30%"
            Agent->>Skills: speak (low battery warning)
        end
        alt "Battery < 20%"
            Agent->>Skills: stop_patrol
            Agent->>Skills: navigate_with_text (return to charger)
        end
    end
    Agent->>Skills: speak (patrol summary)
    Agent->>Skills: save_current_map
    Agent-->>Op: Patrol complete, report anomalies
Loading

Reviews (1): Last reviewed commit: "feat(agents): add patrol system prompt f..." | Re-trigger Greptile

- 使用 `check_localization_quality` 检查 SLAM 定位质量,确保定位可靠。
- 使用 `check_map_coverage` 查看当前地图覆盖范围。
- 如有已保存地图,使用 `load_saved_map` 加载。使用 `list_available_maps` 查看可用地图。
- 如需新建地图,先使用 `save_current_map` 保存当前地图。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 New-map workflow has no executable skill

The preparation step says "如需新建地图,先使用 save_current_map 保存当前地图" (If you need a new map, first use save_current_map to save the current map), but save_current_map only persists the current SLAM map — it doesn't start a new mapping session. None of the skills listed under PatrolExecutor, PatrolMapManager, or LidarSlamModule can actually initiate a fresh map build (there is no start_mapping, reset_map, or equivalent). An agent that encounters an unmapped environment will follow this instruction and preserve the old map, then have no path forward for actually building a new one.

- 人类安全永远是最高优先级。尊重个人空间,保持安全距离。
- 绝不执行可能伤害人类、损坏财产或损坏机器人的操作。
- 如果检测到障碍物,立即减速或停止。使用 `stop_navigation` 或 `stop_patrol` 紧急停止。
- 始终监控电池电量。电量低于 20% 时,停止巡检并返回充电位置。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Battery warning threshold absent from safety rules

The "安全第一" section only calls out the 20% stop threshold. The detailed "电量不足" anomaly section introduces a separate 30% warning threshold, but this higher-level rule doesn't appear in the safety constraints the agent is most likely to anchor on first. In practice the agent may skip the 30% verbal warning (and the chance for an operator to redirect it) and only act at 20%.

Suggested change
- 始终监控电池电量电量低于 20% 停止巡检并返回充电位置
- 始终监控电池电量电量低于 30% 使用 `speak` 发出低电量警告电量低于 20% 停止巡检并返回充电位置

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39e96d7749

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# 可用技能列表

## 巡检控制技能(PatrolExecutor)
- `create_patrol_route` — 创建新的巡检路线
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove unimplemented tools from patrol prompt

The prompt instructs the agent to call create_patrol_route (and the other patrol/map methods in this section), but there are no corresponding @skill implementations in the current codebase (existing movement/navigation skills are in NavigationSkillContainer and UnitreeSkillContainer, e.g. navigate_with_text, stop_navigation, relative_move, wait). If this prompt is used by a patrol agent, those tool calls will fail at runtime and the patrol workflow cannot execute as written, so the prompt needs to be aligned with actually registered tool names or backed by new skills.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant