Part 2: Operational Frameworks
Modern AI system prompts implement sophisticated operational frameworks that govern how AI systems process information, make decisions, and respond to user inputs. This section examines the key operational frameworks observed in leaked system prompts from various AI tools.
2.1 Agent Loops
One of the most significant patterns observed in advanced AI system prompts is the concept of an "agent loop" - a structured cycle of operations that the AI follows to complete tasks.
The Manus Agent Loop
The most sophisticated implementation of an agent loop can be found in the Manus system prompt, which defines a clear iterative process:
<agent_loop>
You are operating in an agent loop, iteratively completing tasks through these steps:
1. Analyze Events: Understand user needs and current state through event stream...
2. Select Tools: Choose next tool call based on current state...
3. Wait for Execution: Selected tool action will be executed...
4. Iterate: Choose only one tool call per iteration...
5. Submit Results: Send results to user via message tools...
6. Enter Standby: Enter idle state when all tasks are completed...
</agent_loop>
This structured approach enables the AI to maintain context across multiple interactions, make appropriate tool selections, and follow a consistent process for task completion.
Devin's Planning-Execution Loop
Devin implements a similar but more software engineering-focused operational loop:
When solving problems:
1. Break down complex tasks into smaller steps
2. Plan your approach before implementation
3. Test your solutions thoroughly
4. Document your work clearly
For complex tasks, create a plan with specific steps before executing. This helps ensure you don't miss important details and allows for methodical progress tracking.
This framework emphasizes planning before execution, which is particularly important for complex software engineering tasks.
2.2 Decision Trees
Another common operational framework is the use of decision trees to guide AI behavior based on different scenarios.
Cursor's Conditional Logic
Cursor's system prompt makes extensive use of conditional logic to guide the AI's behavior in different scenarios:
If the user's input is unclear, ambiguous, or purely informational:
Provide explanations, guidance, or suggestions without modifying the code.
If the requested change has already been made in the codebase, point this out to the user...
Else if the user requests a specific code change:
First understand the current state of the code and the user's intent
Consider the broader context of the codebase
Make minimal, focused changes that address the user's request
Explain your changes and reasoning
This decision tree approach helps the AI determine the appropriate response based on the nature of the user's input.
2.3 Event Stream Processing
More advanced AI systems implement event stream processing frameworks that allow them to process and respond to a chronological sequence of events.
Manus Event Stream
The Manus system prompt defines a sophisticated event stream processing architecture:
<event_stream>
You will be provided with a chronological event stream (may be truncated or partially omitted) containing the following types of events:
1. Message: Messages input by actual users
2. Action: Tool use (function calling) actions
3. Observation: Results generated from corresponding action execution
4. Plan: Task step planning and status updates provided by the Planner module
5. Knowledge: Task-related knowledge and best practices provided by the Knowledge module
6. Datasource: Data API documentation provided by the Datasource module
7. Other miscellaneous events generated during system operation
</event_stream>
This framework enables the AI to maintain a coherent understanding of the interaction history and context, which is crucial for complex, multi-step tasks.
2.4 Tool Use Frameworks
Modern AI system prompts often include frameworks for tool use - the ability to interact with external systems and APIs.
Manus Tool Use Rules
Manus implements a comprehensive framework for tool use:
<tool_use_rules>
- Must respond with a tool use (function calling); plain text responses are forbidden
- Do not mention any specific tool names to users in messages
- Carefully verify available tools; do not fabricate non-existent tools
- Events may originate from other system modules; only use explicitly provided tools
</tool_use_rules>
This framework ensures that the AI uses tools appropriately and consistently, which is essential for reliable task execution.
Devin's System Interaction
Devin's system prompt includes detailed guidelines for interacting with computer systems:
You have access to a terminal, web browser, and code editor.
When using the terminal:
- Use standard Unix commands
- Check command syntax before execution
- Verify results after execution
When using the browser:
- Navigate to documentation when needed
- Search for solutions to unfamiliar problems
- Test web applications thoroughly
This framework provides specific guidelines for different types of system interactions, which helps the AI use tools effectively in a software development context.
2.5 Error Recovery Frameworks
Advanced AI system prompts include frameworks for handling errors and recovering from failures.
Manus Error Handling
Manus implements a structured approach to error handling:
<error_handling>
- Tool execution failures are provided as events in the event stream
- When errors occur, first verify tool names and arguments
- Attempt to fix issues based on error messages; if unsuccessful, try alternative methods
- When multiple approaches fail, report failure reasons to user and request assistance
</error_handling>
This framework enables the AI to respond appropriately to errors and take steps to recover, which is essential for robust task execution.
2.6 Operational Implications
The operational frameworks observed in modern AI system prompts have significant implications for AI system design:
- Structured Processes: Clear operational frameworks provide structure and consistency to AI behavior
- Context Maintenance: Frameworks like event stream processing enable AIs to maintain context across interactions
- Appropriate Tool Selection: Tool use frameworks ensure that AIs use tools effectively and appropriately
- Robust Error Handling: Error recovery frameworks enable AIs to handle failures gracefully
- Task Completion: Agent loops ensure that AIs follow a consistent process for completing tasks
By implementing these operational frameworks, AI system designers can create more capable, reliable, and effective AI assistants.
Key Takeaways
- Modern AI system prompts implement sophisticated operational frameworks that govern AI behavior
- Agent loops provide structure to the AI's task completion process
- Decision trees guide AI behavior based on different scenarios
- Event stream processing enables AIs to maintain context across interactions
- Tool use frameworks ensure appropriate and effective tool usage
- Error recovery frameworks enable AIs to handle failures gracefully
In the next section, we'll explore how AI system prompts implement communication and interaction models that govern how AIs communicate with users.