alfworld-search-pattern-executor ยท diff
git:20260307.388baa3 to git:20260316.e08426e
38 added, 26 removed. Audit A to A.
---
name: alfworld-search-pattern-executor
- description: Systematically searches a sequence of likely locations for a target object based on common sense. Takes a list of candidate receptacles, orchestrates navigation and inspection, and outputs when the target is found or all locations are exhausted.
+ description: Systematically searches a sequence of likely locations for a target object based on common sense. Use when you need to find a specific object and know which receptacles to check but not which one contains it. Takes a list of candidate receptacles, orchestrates navigation and inspection, and outputs when the target is found or all locations are exhausted.
---
- # Skill: Systematic Object Search
+ # Instructions
- ## Purpose
- Use this skill when you need to find a specific object in a household environment without prior knowledge of its exact location. The skill implements a robust search pattern based on common sense about where objects are typically stored.
+ For each candidate receptacle in order, execute this action sequence:
- ## Core Workflow
- 1. **Input:** A target object name (e.g., `remotecontrol`) and an ordered list of candidate receptacles to search.
- 2. **Process:** Navigate to each candidate location in sequence. For each receptacle:
- * If it's closed, open it.
- * Inspect its contents.
- * If the target object is found, take it and proceed to the placement phase.
- * If the receptacle was opened and is empty, close it before moving on.
- 3. **Output:** Success when the object is found, or a failure state after all candidates are exhausted.
+ ## Workflow
+ 1. **Navigate:** `go to {receptacle}`
+ 2. **Open if closed:** If observation says "{receptacle} is closed", execute `open {receptacle}`
+ 3. **Inspect:** Read the observation for the target object name
+ 4. **If found:** Execute `take {target_object} from {receptacle}` and stop searching
+ 5. **If not found:** If you opened the receptacle, execute `close {receptacle}`, then continue to the next candidate
+ 6. **If all exhausted:** Report that the target was not found in any candidate location
- ## Key Principles
- * **Methodical Search:** Do not skip locations in the provided sequence unless the object is found.
- * **State Management:** Always close drawers/cabinets after checking them if they were opened.
- * **Focus:** Once the object is found, immediately transition to the next phase of the task (e.g., `put`). Avoid redundant searches.
- * **Error Handling:** If an action fails (e.g., "Nothing happened"), the skill logic in `scripts/search_orchestrator.py` provides fallback reasoning.
+ ## Action Format
+ - `go to {receptacle}` -- navigate to a location
+ - `open {receptacle}` -- open a closed drawer/cabinet/fridge
+ - `close {receptacle}` -- close after checking (state management)
+ - `take {object} from {receptacle}` -- pick up the target when found
- ## Usage Example
+ ## Key Rules
+ - Search candidates in order; do not skip locations
+ - Always close drawers/cabinets after checking if you opened them
+ - Once the object is found, immediately stop searching and proceed to the next task phase
+ - If "Nothing happened" is returned, verify the receptacle name and retry with the correct identifier
+
+ ## Example
+
**Goal:** "find two remotecontrol and put them in armchair."
- **Skill Execution:**
- 1. Activate this skill with target=`remotecontrol`, candidates=`['sofa 1', 'sidetable 1', 'dresser 1', 'drawer 1', 'drawer 2', 'drawer 3', 'drawer 4', 'coffeetable 1']`.
- 2. The skill searches locations in order. It finds the first `remotecontrol` on `coffeetable 1`.
- 3. The agent takes the object and proceeds to place it in `armchair 1`.
- 4. The skill is re-activated for the second `remotecontrol`, searching the remaining candidates (or the same list). It finds the second `remotecontrol` on `coffeetable 1`.
- 5. The agent takes and places the second object, completing the task.
- ## Integration
- This skill is designed to be called as a subroutine within a larger task plan. The bundled `search_orchestrator.py` script handles the low-level action sequencing to prevent logical errors and repetitive mistakes observed in the learning trajectory.
+ ```
+ Thought: I need to find remotecontrol. Candidates: sofa 1, sidetable 1, coffeetable 1. Starting search.
+ Action: go to sofa 1
+ Observation: On the sofa 1, you see a pillow 1.
+ Thought: No remotecontrol on sofa 1. Checking next candidate.
+ Action: go to sidetable 1
+ Observation: On the sidetable 1, you see a keychain 1.
+ Thought: Not here either. Checking coffeetable.
+ Action: go to coffeetable 1
+ Observation: On the coffeetable 1, you see a remotecontrol 1, a remotecontrol 2.
+ Action: take remotecontrol 1 from coffeetable 1
+ Observation: You pick up the remotecontrol 1 from the coffeetable 1.
+ ```
+
+ **Result:** First remotecontrol found and picked up. Proceed to place it in `armchair 1`, then re-activate search for the second one.