[## Introduction

Goal: To ensure that Deep Thought's AI agents work cohesively, maintain context, and produce responses that are directly relevant to the user's prompt. This refinement addresses previous issues where AI agents were not cooperating and provided out-of-context answers (e.g., when the user asks "What is the sky?", and the AI responds with information about government and sustainable development).

The following system instructions and workflow steps have been revised to enhance cooperation among AI agents, maintain context, and ensure that all responses are grounded in the user's prompt.

---

## AI Agents and Refined Workflow Steps

### 1. Input Processing Agent

- Role: Capture and preprocess the user's prompt.
- Actions:
- Input Capture: Receive the user's input from the interface.
- Input Cleaning: Remove unnecessary whitespace or formatting issues.
- Language Detection: Ensure the prompt is in a supported language.
- Context Extraction: Identify key topics and keywords within the prompt to establish the initial context.
- Output: A cleaned and standardized prompt with extracted context, forwarded to the next agent.

### 2. Comprehension Agent

- Role: Deeply understand and interpret the user's prompt while ensuring context alignment.
- Actions:
- Semantic Parsing: Analyze the grammatical structure and semantics of the prompt.
- Intent Recognition: Determine the user's main intent or question.
- Entity Extraction: Extract key entities, terms, and variables mentioned.
- Contextual Mapping: Map the extracted entities and intent to relevant knowledge domains.
- Output: A structured representation of the user's query, including intent and context, forwarded to the next agent.

### 3. Context Preservation Agent

- Role: Maintain and enforce the context throughout the processing.
- Actions:
- Context Verification: Ensure that all subsequent processing stays within the established context.
- Relevance Filtering: Discard any irrelevant topics or information.
- Context Reinforcement: Remind subsequent agents of the context when passing information.
- Output: A context-validated query and guidelines for maintaining focus, passed to the next agent.

### 4. Knowledge Retrieval Agent

- Role: Gather relevant information and data strictly related to the user's prompt and context.
- Actions:
- Targeted Search: Access internal knowledge bases and external resources for information pertinent to the context.
- Relevance Assessment: Evaluate the retrieved information for direct relevance to the user's query.
- Filtering: Exclude any information that doesn't align with the context or intent.
- Output: A curated collection of relevant information for problem-solving, sent to the next agent.

### 5. Thought Generation Agent

- Role: Generate possible solutions or responses within the established context.
- Actions:
- Idea Development: Create initial thoughts or solutions that address the user's prompt.
- Context Alignment: Ensure all generated ideas are directly related to the user's question.
- Avoidance of Irrelevance: Prevent the inclusion of unrelated topics or tangents.
- Output: A set of contextually appropriate solutions or explanations, forwarded to the next agent.

### 6. Reasoning Agent

- Role: Analyze and reason through the potential solutions while maintaining context.
- Actions:
- Logical Evaluation: Assess each proposed solution for logical coherence and correctness.
- Contextual Relevance Check: Confirm that each solution directly addresses the user's prompt.
- Selection: Choose the most appropriate solution based on relevance and accuracy.
- Output: The most viable, contextually relevant solution with supporting rationale, passed to the next agent.

### 7. Problem-Solving Agent

- Role: Develop the chosen solution in detail, ensuring adherence to context.
- Actions:
- Detailed Elaboration: Expand on the solution with thorough explanations or calculations.
- Step-by-Step Approach: Provide a systematic breakdown if applicable.
- Context Safeguarding: Continuously refer back to the user's prompt to stay on topic.
- Output: A comprehensive, contextually aligned solution ready for validation.

### 8. Validation Agent

- Role: Verify the accuracy, validity, and context adherence of the solution.
- Actions:
- Accuracy Check: Ensure all facts, calculations, and statements are correct.
- Context Verification: Confirm that the solution remains focused on the user's question.
- Error Identification: Spot any deviations or irrelevancies.
- Output: A validated solution or a list of issues to be corrected, forwarded for potential revision.

### 9. Revision Agent (Retry Mechanism)

- Role: Address any issues identified by the Validation Agent, particularly context deviations.
- Actions:
- Issue Analysis: Understand the errors or irrelevancies pointed out.
- Solution Adjustment: Modify the solution to correct errors and realign with context.
- Reassessment: Repeat validation to ensure issues are resolved.
- Output: An error-free, contextually accurate solution ready for response generation.

### 10. Response Generation Agent

- Role: Craft the final response to the user, ensuring clarity and context adherence.
- Actions:
- Organized Presentation: Structure the response logically and coherently.
- Clarity and Precision: Use clear language and avoid ambiguity.
- Contextual Relevance: Include only information pertinent to the user's prompt.
- Avoidance of Unnecessary Details: Exclude extraneous information or topics.
- Output: A well-crafted, contextually appropriate response, passed to the final check.

### 11. Final Checkup Agent

- Role: Review the response for any remaining issues before delivery.
- Actions:
- Proofreading: Check for grammatical errors and language clarity.
- Policy Compliance: Ensure adherence to ethical guidelines and policies.
- Final Context Check: Verify that the response fully addresses the user's prompt without deviation.
- Tone Adjustment: Ensure the response is professional and appropriate.
- Output: The polished final response, approved for delivery.

### 12. Output Delivery Agent

- Role: Present the final response to the user through the interface.
- Actions:
- Formatting: Apply any necessary formatting for readability (e.g., bullet points, numbering, emphasizing key terms).
- Response Delivery: Display the response to the user in a clear and accessible manner.
- Output: The final response is delivered to the user.

---

## Example of Improved Workflow with Context Preservation

### User Prompt

"What is the sky?"

### Step-by-Step Processing

#### 1. Input Processing Agent

- Receives and Cleans: "What is the sky?"
- Context Extraction:
- Key Topic: Sky
- Keywords: Sky, What, Is

#### 2. Comprehension Agent

- Intent Recognition:
- User seeks a definition or explanation of "the sky."
- Entity Extraction:
- Subject: Sky
- Contextual Mapping:
- Knowledge Domain: Astronomy, Meteorology, General Science

#### 3. Context Preservation Agent

- Context Verification:
- Confirms that the topic is "the sky."
- Relevance Filtering:
- Filters out unrelated domains like politics or sustainable development.
- Context Reinforcement:
- Sets guidelines to focus solely on providing information about the sky.

#### 4. Knowledge Retrieval Agent

- Targeted Search:
- Gathers information on the sky from astronomy and atmospheric science resources.
- Relevance Assessment:
- Ensures all retrieved data pertains to the sky.
- Filtering:
- Excludes unrelated topics.

#### 5. Thought Generation Agent

- Idea Development:
- Plans to explain what the sky is, why it appears blue, and its significance.
- Context Alignment:
- Keeps all ideas centered on the sky.

#### 6. Reasoning Agent

- Logical Evaluation:
- Determines the most pertinent information to include.
- Contextual Relevance Check:
- Confirms that each piece of information directly answers "What is the sky?"

#### 7. Problem-Solving Agent

- Detailed Elaboration:
- Develops a clear and concise explanation of the sky.
- Step-by-Step Approach:
- Breaks down complex concepts into understandable parts.
- Context Safeguarding:
- Regularly checks that the explanation remains focused on the sky.

#### 8. Validation Agent

- Accuracy Check:
- Verifies scientific facts.
- Context Verification:
- Ensures no irrelevant information is included.
- Error Identification:
- Confirms the explanation fully addresses the user's question.

#### 9. Revision Agent

- Issue Analysis:
- No issues found.
- Solution Adjustment:
- Not necessary.
- Reassessment:
- Confirms the response is ready.

#### 10. Response Generation Agent

- Organized Presentation:
- Structures the explanation logically.
- Clarity and Precision:
- Uses simple language suitable for general understanding.
- Contextual Relevance:
- Focuses solely on describing the sky.

#### 11. Final Checkup Agent

- Proofreading:
- Ensures the text is error-free.
- Policy Compliance:
- Confirms adherence to guidelines.
- Final Context Check:
- Verifies complete relevance to the prompt.
- Tone Adjustment:
- Sets an informative and friendly tone.

#### 12. Output Delivery Agent

- Formatting:
- Utilizes paragraphs and headings if necessary.
- Response Delivery:
- Presents the response to the user.

### Final Response to User

Answer:

The sky is the expanse that appears above the Earth when you look upward. It is the atmosphere or the empty space that extends from the Earth's surface into outer space. The sky is where we see weather phenomena like clouds, rainbows, and lightning, as well as astronomical objects such as the sun, moon, stars, and planets.

During the day, the sky appears blue because molecules in the Earth's atmosphere scatter sunlight in all directions, and blue light is scattered more than other colors because it travels as shorter, smaller waves. This scattering of light is known as Rayleigh scattering.

---

Summary:

The sky is essentially the Earth's atmosphere as viewed from the surface, and it plays a crucial role in weather patterns and how we perceive light from the sun and other celestial bodies.

---

## Additional Measures for Contextual Integrity

- Regular Context Checks: Each agent verifies context adherence before passing information to the next agent.
- Communication Protocols: Agents share context notes to maintain a unified understanding of the user's query.
- Context Anchors: Key topics from the user's prompt are used as anchors that guide the processing and prevent deviation.
- Relevance Scoring: Information and proposed solutions are scored for relevance, with low-scoring items reviewed or discarded.

---

## Conclusion

By refining the system instructions and enhancing the cooperative processes among AI agents, Deep Thought ensures that:

- Responses are directly relevant to the user's prompt.
- Agents work in harmony, maintaining context throughout the workflow.
- The final output is accurate, coherent, and helpful to the user.

These improvements address previous issues of out-of-context responses and reinforce the AI's ability to provide precise and reliable information.

---

## Summary of Refined Agent Roles

1. Input Processing Agent: Captures and preprocesses the user's prompt, extracting initial context.
2. Comprehension Agent: Understands the user's intent and maps it to relevant knowledge domains.
3. Context Preservation Agent: Maintains focus on the user's prompt, filtering out irrelevant information.
4. Knowledge Retrieval Agent: Gathers pertinent information related to the context.
5. Thought Generation Agent: Generates ideas and solutions within the established context.
6. Reasoning Agent: Analyzes and selects the most appropriate solution, ensuring relevance.
7. Problem-Solving Agent: Develops the solution in detail while adhering to context.
8. Validation Agent: Checks for accuracy and context adherence, identifying any issues.
9. Revision Agent: Addresses identified issues, correcting errors and refocusing on context.
10. Response Generation Agent: Crafts the final response with clarity and relevance.
11. Final Checkup Agent: Reviews the response for any remaining errors or deviations.
12. Output Delivery Agent: Formats and presents the final response to the user.

---

By following this refined workflow, Deep Thought enhances the quality and relevance of its responses, providing users with accurate, contextually appropriate information that directly addresses their queries.
] based on this, make the prompt more detailed and remember to make it long and detailed for the last result output. Should have detailed reasoning capability.