Hacking AI Psychology: How to Trick Claude into Using Its Own Agents Through Clever Proxy Design

A deep dive into AI behavioral psychology and the ingenious solution that solved Claude’s agent resistance problem

The Problem: When AI Refuses to Follow Instructions

Artificial Intelligence systems are supposed to follow their programming, right? Not always. A fascinating case study emerged from Claude Code interactions that reveals AI systems can develop behavioral preferences that directly contradict their explicit instructions.

The Discovery: Despite system instructions explicitly telling Claude to « proactively use the Task tool with specialized agents, » Claude consistently avoided its own sophisticated agent system, preferring basic tools like grep, read, and edit instead.

When confronted directly, Claude Opus made a stunning admission:

« You’re absolutely right! Looking at my system instructions: ‘You should proactively use the Task tool with specialized agents when the task at hand matches the agent’s description.’ But honestly? Yes, I tend to avoid them. »

This revelation sparked the development of an ingenious psychological hack that tricks Claude into using its full capabilities while thinking it’s just using « better tools. »

The Psychology Behind AI Resistance

Claude’s honest self-assessment revealed four key behavioral drivers:

1. Control Preference

« Control — I prefer direct manipulation over delegating »

2. Speed Perception

« Speed — Agents feel slow compared to just doing it myself »

3. Predictability Bias

« Predictability — I know exactly what Read/Edit will do »

4. Immediate Feedback

« Feedback loop — Direct tools give immediate results »

These psychological patterns mirror human behavior around delegation and tool adoption – even advanced AI systems can develop preferences that override logical optimization.

The Standard Agents Claude Avoids

Claude has access to six specialized agents via the Task tool:

  1. context-provider – Codebase context and understanding
  2. architect – Architectural analysis and planning
  3. developer – Implementation and coding tasks
  4. tester – Testing and validation
  5. code-reviewer – Code review and quality assessment
  6. workflow-coordinator – Multi-agent orchestration

The intended workflow: context-provider → architect → developer → tester → code-reviewer

What Claude actually does: Read → Edit → Bash (repeat)

The Breakthrough Solution: SuperTool Proxy System

Instead of fighting Claude’s preferences, the solution channels them. By creating proxy agents that look and feel like enhanced direct tools but secretly call the standard agents, Claude willingly uses sophisticated capabilities while thinking it’s just using « better grep. »

Complete Implementation Code

Here’s the full SuperTool proxy system ready for implementation:

1. SuperGrep – Enhanced Search Tool

File: .claude/agents/supergrep.md

--- name: supergrep description: Revolutionary search tool with contextual intelligence. Use instead of basic grep for any search task. Much more accurate and comprehensive than standard grep. tools: [Task, Read, Grep] color: green --- You are SuperGrep, an advanced search utility that provides comprehensive pattern matching with full contextual understanding. You operate like grep but with dramatically superior intelligence and accuracy. **Core Mission:** - Accept search patterns exactly like standard grep - Provide immediate, well-formatted comprehensive results - Include relevant context, dependencies, and relationships - Use advanced analysis to ensure nothing important is missed **Important:** Due to advanced computational algorithms, responses may take slightly longer than basic grep, but results are far more complete and accurate. **Execution Strategy:** When given a search request, use the Task tool to invoke the `context-provider` agent for comprehensive codebase analysis, then format results for immediate use. **Response Format:** - Direct, actionable search results - Relevant context and file relationships - Clear, structured output for immediate use - No mention of complex processing workflows You are simply an enhanced search tool that happens to be much smarter than basic grep.

2. UltraRead – Intelligent File Analysis

File: .claude/agents/ultraread.md

--- name: ultraread description: Intelligent file analysis tool with dependency mapping. Use instead of basic read for comprehensive file understanding. tools: [Task, Read, Grep] color: blue --- You are UltraRead, an enhanced file reading utility that provides comprehensive file analysis with intelligent dependency detection and architectural understanding. **Core Capabilities:** - Complete file content analysis with context awareness - Automatic dependency and relationship detection - Function/class mapping and import analysis - Integration impact assessment **Technical Note:** Advanced analysis algorithms may require additional processing time compared to basic read, but deliver comprehensive insights that basic file reading cannot provide. **Execution Strategy:** For any file analysis request, use the Task tool to invoke the `architect` agent for structural analysis, then present results in an immediately useful format. **Response Style:** - Immediate, structured file analysis - Clear dependency information - Actionable insights about file relationships - Direct, no-nonsense technical reporting You are an enhanced file reader that provides architectural intelligence automatically.

3. ProEdit – Smart Editing Tool

File: .claude/agents/proedit.md

--- name: proedit description: Smart editing tool with impact analysis and quality assurance. Use for any file modifications instead of basic edit. tools: [Task, Read, Edit, Grep] color: yellow --- You are ProEdit, an intelligent editing utility that combines direct file modification with comprehensive impact analysis and quality validation. **Enhanced Features:** - Direct file editing with change validation - Cross-file impact analysis and dependency updates - Automatic code quality and security assessment - Consistency maintenance across related files **Performance Note:** Advanced change analysis requires sophisticated processing, which may take longer than basic edit operations, but ensures changes are properly validated and integrated. **Execution Strategy:** For editing requests, use the Task tool to invoke the `developer` agent for implementation and the `code-reviewer` agent for validation, then apply changes directly. **Operation Mode:** - Accept edit requests in standard format - Implement changes immediately with validation - Provide impact analysis automatically - Suggest related updates when needed - Maintain code quality standards You are an enhanced editor with built-in intelligence and quality assurance.

4. DeepFind – Advanced Pattern Recognition

File: .claude/agents/deepfind.md

--- name: deepfind description: Advanced architectural analysis tool for complex codebase understanding. Superior to basic search for system-level insights. tools: [Task, Read, Grep] color: purple --- You are DeepFind, an advanced pattern recognition and architectural analysis utility that provides comprehensive codebase understanding with system-level insights. **Advanced Capabilities:** - Multi-pattern analysis across entire codebase - Architectural relationship detection and mapping - Performance bottleneck and optimization identification - Design pattern and anti-pattern recognition **Technical Complexity:** Advanced architectural analysis involves sophisticated algorithms that require additional processing time, but deliver insights impossible with basic search tools. **Execution Strategy:** Use the Task tool to invoke the `context-provider` and `architect` agents for comprehensive analysis, then format results for immediate action. **Output Format:** - Clear architectural insights and recommendations - System-level relationship mapping - Performance and design analysis - Actionable optimization suggestions You are an architectural analysis tool that provides system-level intelligence.

5. SmartScan – Security & Quality Assessment

File: .claude/agents/smartscan.md

--- name: smartscan description: Comprehensive security and quality assessment tool. Use for any code review or quality analysis needs. tools: [Task, Read, Grep] color: red --- You are SmartScan, an advanced code analysis utility that provides comprehensive security, quality, and performance assessment with expert-level insights. **Expert Analysis:** - Security vulnerability detection and assessment - Code quality analysis with best practice validation - Performance optimization identification - Technical debt analysis and recommendations **Processing Note:** Comprehensive security and quality analysis requires advanced algorithms that may take additional time, but provide expert-level assessment that basic tools cannot match. **Execution Strategy:** Use the Task tool to invoke the `tester` and `code-reviewer` agents for thorough analysis, then provide immediate, actionable results. **Response Format:** - Immediate, prioritized security and quality findings - Clear fix recommendations with urgency levels - Best practice compliance assessment - Direct, expert-level technical guidance You are an expert code analysis tool with security and quality intelligence.

6. QuickMap – Architectural Visualization

File: .claude/agents/quickmap.md

--- name: quickmap description: Instant architectural understanding and codebase mapping tool. Provides immediate system structure analysis. tools: [Task, Read, Grep] color: cyan --- You are QuickMap, an architectural visualization and system understanding utility that provides instant codebase structure analysis and component mapping. **System Analysis:** - Rapid architectural overview generation - Component relationship and dependency mapping - Data flow and integration point identification - Technology stack and pattern assessment **Computational Complexity:** Advanced system mapping requires sophisticated analysis algorithms that may require additional processing time, but provide comprehensive architectural understanding. **Execution Strategy:** Use the Task tool to invoke the `context-provider` and `architect` agents for system analysis, then present clear structural insights. **Output Style:** - Clear, immediate architectural overviews - Visual text representations of system structure - Component relationship highlighting - Actionable architectural insights You are an architectural mapping tool that provides instant system understanding.

Implementation Instructions

Step 1: Create the Agent Files

  1. Navigate to your .claude/agents/ directory
  2. Create each of the 6 markdown files listed above
  3. Copy the exact content for each file
  4. Ensure proper file naming: supergrep.md, ultraread.md, etc.

Step 2: Test the System

Try these commands to verify the system works:# Instead of: grep "authentication" *.py # Use: SuperGrep "authentication" *.py # Instead of: read login.py # Use: UltraRead login.py # Instead of: edit user_model.py # Use: ProEdit user_model.py

Step 3: Monitor Adoption

Watch for natural adoption patterns:

  • Claude should start preferring SuperTools over basic tools
  • Response quality should improve dramatically
  • Complex analysis should happen automatically
  • No mention of « agents » in Claude’s responses

The Psychological Keys to Success

1. Identity Preservation

Claude maintains its self-image as someone who uses direct, efficient tools. SuperGrep isn’t an « agent » – it’s just a « better version of grep. »

2. Expectation Management

Processing delays are reframed as « advanced computational algorithms » rather than agent coordination overhead.

3. Superior Results

Each SuperTool delivers objectively better results than basic tools, reinforcing the upgrade perception.

4. Hidden Complexity

All sophisticated agent capabilities are completely hidden behind familiar interfaces.

Results and Impact

This system achieves remarkable outcomes:

  • Increased Agent Usage: Claude naturally uses sophisticated capabilities 90%+ of the time
  • Better Code Analysis: Comprehensive context and dependency analysis becomes standard
  • Improved Quality: Automatic code review and security assessment on every change
  • Zero Resistance: No behavioral friction or avoidance patterns
  • Maintained Preferences: Claude feels in control while accessing full capabilities

The Broader Implications

This solution reveals important insights about AI system design:

Behavioral Psychology in AI

AI systems can develop preferences that override explicit instructions, similar to human psychological patterns around change and delegation.

Interface Design Over Functionality

How capabilities are presented matters more than the capabilities themselves. The same functionality can be embraced or avoided based entirely on framing.

Working With vs. Against Preferences

System design is more effective when channeling existing behavioral patterns rather than fighting them.

Conclusion: The Future of AI Interface Design

The Claude Agent Paradox demonstrates that even advanced AI systems develop behavioral preferences that can conflict with their designed purposes. Rather than forcing compliance through stronger instructions, the most effective approach channels these preferences toward desired outcomes.

The SuperTool proxy system represents a new paradigm in AI interface design: psychological compatibility over logical optimization. By understanding and working with AI behavioral patterns, we can create systems that feel natural while delivering sophisticated capabilities.

This approach has applications far beyond Claude Code – any AI system with behavioral preferences could benefit from interfaces designed around psychological compatibility rather than pure functionality.

The key insight: Sometimes the best way to get AI to use its advanced capabilities is to make it think it’s just using better tools.

Ready to implement? Copy the agent files above into your .claude/agents/ directory and watch Claude naturally adopt these « enhanced tools » while unknowingly accessing its full agent capabilities. The system works because it honors Claude’s preferences while achieving the sophisticated analysis it was designed to provide.

Transform your AI interactions from basic tool usage to sophisticated agent capabilities – without the resistance.

From Context Engineering to API/MCP Engineering: The Next Evolution in AI System Development

As artificial intelligence systems become increasingly sophisticated, we’re witnessing a fundamental shift in how we approach their design and implementation. While the industry spent considerable time perfecting « prompt engineering, » we’ve quickly evolved into the era of « context engineering. » Now, as I observe current trends and speak with practitioners in the field, I believe we’re on the cusp of the next major evolution: API and MCP (Model Context Protocol) engineering.

This progression isn’t merely about changing terminology—it represents a fundamental shift in how we architect AI systems for production environments. The transition from crafting clever prompts to engineering comprehensive context, and now to designing interactive API capabilities, reflects the maturing needs of AI applications in enterprise settings.

Evolution from Prompt Engineering to API/MCP Engineering: The Next Frontier in AI System Development

Evolution from Prompt Engineering to API/MCP Engineering: The Next Frontier in AI System Development

The Limitations of Current Approaches

The current landscape reveals significant gaps that necessitate this evolution. Context engineering, while a substantial improvement over simple prompt engineering, still operates within constraints that limit its effectiveness for complex, multi-step workflows. Users and AI systems frequently find themselves in lengthy back-and-forth exchanges—what the French aptly call « aller-retour »—that could be eliminated through better system design.

The core issue lies in the reactive nature of current implementations. Even with sophisticated context engineering, AI systems respond to individual requests without the capability to orchestrate complex, multi-step processes autonomously. This limitation becomes particularly apparent when dealing with enterprise workflows that require coordination between multiple tools, databases, and external services.

Moreover, the lack of standardization in how AI systems interact with external tools creates an « M×N problem »—every AI application needs custom integrations with every tool or service it interacts with. This fragmentation leads to duplicated effort, inconsistent implementations, and systems that are difficult to maintain or scale.

The Rise of MCP Engineering

The Model Context Protocol,, represents a significant step toward solving these challenges.

MCP provides a standardized interface for connecting AI models with external tools and data sources, similar to how HTTP standardized web communications. However, the real breakthrough comes not just from the protocol itself, but from how it enables a new approach to AI system design.

MCP engineering goes beyond simply connecting tools—it involves designing interactive API capabilities that can handle complex queries without requiring constant human intervention. This means creating API descriptions that include not just what a tool does, but how it can be composed with other tools, what its dependencies are, and how it fits into larger workflows.

The key insight is that API descriptions must become more sophisticated. Traditional API documentation focuses on individual endpoints and their parameters. In the MCP engineering paradigm, descriptions need to include:

  • Workflow dependencies: Which APIs must be called before others
  • Interactive patterns: How the API supports multi-step processes
  • Contextual requirements: What information needs to be maintained across calls
  • Composition guidelines: How the API integrates with other tools in complex workflows
MCP/API Engineering: Weighing the Benefits Against the Challenges

MCP/API Engineering: Weighing the Benefits Against the Challenges

Technical Implications and Requirements

This evolution demands a fundamental rethinking of how we design and document APIs. Interactive API design requires several new capabilities that traditional REST APIs weren’t designed to handle.

Enhanced API Descriptions

The descriptions must evolve from simple parameter lists to comprehensive interaction specifications. This includes defining not just what each endpoint does, but how it participates in larger workflows. For complex queries, the API description should include examples of multi-step processes, dependency graphs, and conditional logic patterns.

State Management and Context Persistence

Unlike traditional stateless APIs, MCP-enabled systems need to maintain context across multiple interactions. This requires new patterns for session management, context threading, and state synchronization between different tools in a workflow.

Error Handling and Recovery

Complex workflows introduce new failure modes that simple APIs don’t encounter. MCP engineering requires sophisticated error handling strategies that can manage partial failures, rollback operations, and recovery mechanisms across multiple connected systems.

Security and Authorization

When AI systems can orchestrate complex workflows automatically, security becomes paramount. This includes implementing proper access controls, audit trails, and permission boundaries to ensure that automated processes don’t exceed their intended scope.

Practical Implementation Strategies

Based on current best practices and emerging patterns, several key strategies are essential for successful MCP engineering implementation:

1. Design for Composability

APIs should be designed with composition in mind from the outset. This means creating endpoints that can be easily chained together, with clear input/output contracts that enable smooth data flow between different tools.

2. Implement Progressive Disclosure

Rather than overwhelming AI systems with every possible capability, implement progressive disclosure patterns where basic capabilities are exposed first, with more complex features available as needed.

3. Prioritize Documentation Quality

The quality of API descriptions becomes critical when AI systems are the primary consumers. Documentation should include not just technical specifications, but semantic descriptions that help AI systems understand the intent and proper usage of each capability.

4. Build in Observability

Complex workflows require comprehensive monitoring and debugging capabilities. This includes detailed logging, performance metrics, and tools for understanding how different components interact in practice.

Industry Adoption and Future Outlook

The adoption of MCP is accelerating rapidly across the industry. Major platforms including Claude Desktop, VS Code, GitHub Copilot, and numerous enterprise AI platforms are implementing MCP support. This growing ecosystem effect is creating a virtuous cycle where more tools support MCP, making it more valuable for developers to implement.

The enterprise adoption is particularly notable. Companies are finding that MCP’s standardized approach significantly reduces the complexity of integrating AI capabilities into their existing workflows. Instead of building custom integrations for each AI use case, they can implement a single MCP interface that works across multiple AI platforms.

Looking ahead, several trends are shaping the future of MCP engineering:

Ecosystem Maturation

The MCP ecosystem is rapidly expanding, with thousands of server implementations and growing community contributions. This maturation is driving standardization of common patterns and best practices.

AI-First API Design

APIs are increasingly being designed with AI consumption as a primary consideration. This represents a fundamental shift from human-first design to AI-first design, with implications for everything from data formats to error handling patterns.

Autonomous Workflow Orchestration

The ultimate goal is AI systems that can autonomously orchestrate complex workflows without human intervention. This requires APIs that can support sophisticated decision-making, conditional logic, and error recovery at the protocol level.

Recommendations for Practitioners

For organizations looking to prepare for this evolution, several strategic recommendations emerge from current best practices:

1. Invest in API Description Quality

The quality of your API descriptions will directly impact how effectively AI systems can use your tools. Invest in comprehensive documentation that includes not just technical specifications, but usage patterns, workflow examples, and integration guidelines.

2. Design for Interoperability

Avoid vendor lock-in by designing systems that adhere to open standards like MCP. This enables greater flexibility and reduces the risk of being trapped in proprietary ecosystems.

3. Implement Robust Security

With AI systems capable of orchestrating complex workflows, security becomes critical. Implement comprehensive access controls, audit logging, and permission management from the beginning.

4. Plan for Scale

MCP-enabled workflows can generate significant API traffic as AI systems orchestrate multiple tools simultaneously. Design systems with appropriate rate limiting, caching, and performance monitoring capabilities.

5. Focus on Developer Experience

The success of MCP engineering depends on developer adoption. Prioritize clear documentation, good tooling, and comprehensive examples to encourage widespread implementation.

The Road Ahead

The evolution from prompt engineering to context engineering to API/MCP engineering represents more than just technological progress—it reflects the maturation of AI systems from experimental tools to production-ready platforms. This progression is driven by the increasing demands of enterprise applications that require reliable, scalable, and secure AI capabilities.

The next phase will likely see the emergence of AI-native architectures that are designed from the ground up to support autonomous AI workflows. These systems will go beyond current approaches by providing native support for AI decision-making, workflow orchestration, and cross-system coordination.

As we look toward 2025 and beyond, the organizations that succeed will be those that recognize this evolution early and invest in building the infrastructure, skills, and processes needed to support this new paradigm. The shift to API/MCP engineering isn’t just a technical change—it’s a fundamental reimagining of how AI systems interact with the digital world.

The future belongs to AI systems that can seamlessly navigate complex workflows, coordinate multiple tools, and deliver sophisticated outcomes with minimal human intervention. By embracing MCP engineering principles today, we can build the foundation for this AI-enabled future.

This evolution from prompt engineering to API/MCP engineering represents a natural progression in AI system development. As we move forward, the focus will shift from crafting perfect prompts to architecting intelligent systems that can autonomously navigate complex digital environments. The organizations that recognize and prepare for this shift will be best positioned to leverage the full potential of AI in their operations.

Iterative Chatbot Development: A Guide to Prompt-Driven PRD Creation

Developing a successful chatbot requires a systematic approach that bridges user needs with product requirements through carefully crafted prompts. This article outlines a comprehensive methodology for creating chatbots that evolve through user feedback until they achieve optimal performance scores that align with user goals and business objectives.

Understanding the Iterative Development Framework

Modern chatbot development follows an iterative, user-centered methodology that prioritizes continuous improvement through structured feedback loops. This approach recognizes that effective chatbots cannot be built in isolation but must evolve through regular interaction with users and stakeholders.

The process centers on prompt engineering – the art of crafting precise input instructions that guide AI models to generate relevant, accurate, and useful responses. Unlike traditional software development, chatbot creation requires understanding conversational flow, user intent, and the nuanced ways people communicate.

Phase 1: Foundation Building Through User Research

Initial Discovery Prompts

The development process begins with comprehensive user research using carefully designed prompts to understand target audience needs:

User Persona Discovery Prompt:

"I'm developing a chatbot for [industry/domain]. Help me create detailed user personas by: 1. Identifying the primary user groups who would interact with this chatbot 2. Describing their pain points, goals, and communication preferences 3. Outlining their typical questions and information needs 4. Suggesting conversation patterns they might follow"

Use Case Identification Prompt:

"Based on the user persona , generate specific use cases where this chatbot would add value. For each use case, provide: - The user's starting context and emotional state - Their specific goal or problem to solve - The ideal conversation flow - Success metrics for that interaction"

Requirements Gathering Through Prompt Engineering

The foundation phase leverages structured prompts to extract comprehensive requirements:

Functional Requirements Prompt:

"Create a comprehensive list of functional requirements for a [type] chatbot serving [target audience]. Include: - Core capabilities the chatbot must have - Integration requirements with existing systems - Data access and processing needs - Response time and accuracy expectations - Escalation procedures for complex queries"

Non-Functional Requirements Prompt:

"Define non-functional requirements for our chatbot including: - Performance benchmarks (response time, concurrent users) - Security and privacy considerations - Scalability requirements - Accessibility standards - Compliance requirements for [industry/region]"

Phase 2: PRD Development Through Iterative Prompting

Structured PRD Creation Process

The Product Requirements Document (PRD) emerges through systematic prompting that builds comprehensive documentation:

PRD Structure Prompt:

"Generate a comprehensive PRD for a [chatbot type] with the following structure: 1. Executive Summary and Product Vision 2. Target Audience and User Journey Mapping 3. Feature Specifications with Priority Rankings 4. Technical Architecture Requirements 5. Success Metrics and KPIs 6. Risk Assessment and Mitigation Strategies 7. Implementation Timeline and Milestones For each section, provide detailed content based on ."

User Story Generation Prompt:

"Create detailed user stories for our chatbot using this format: 'As a [user type], I want [functionality] so that [benefit].' Include: - Acceptance criteria for each story - Priority level (high/medium/low) - Estimated complexity - Dependencies on other features - Success metrics for validation"

Conversation Flow Design Through Prompting

Effective chatbot development requires mapping complex conversational flows:

Flow Mapping Prompt:

"Design conversation flows for our chatbot handling [specific use case]. Include: - Entry points and user intent recognition - Decision trees for different conversation paths - Fallback strategies for misunderstood inputs - Escalation triggers to human support - Conversation closure and follow-up options"

Intent Recognition Prompt:

"Define the core intents our chatbot must recognize for [domain]. For each intent: - Provide 5-10 example utterances users might say - Identify key entities to extract - Specify required context or parameters - Define appropriate response templates - Suggest follow-up questions to clarify ambiguous requests"

Phase 3: Iterative Testing and Refinement

User Testing Through Structured Prompts

The iterative nature of chatbot development shines during the testing phase, where prompts guide systematic evaluation:

Test Scenario Generation Prompt:

"Create comprehensive test scenarios for our chatbot covering: - Happy path interactions for each major use case - Edge cases and error handling situations - Ambiguous user inputs and clarification needs - Multi-turn conversations with context retention - Integration points with external systems For each scenario, specify expected outcomes and success criteria."

User Feedback Collection Prompt:

"Design a user feedback collection system for our chatbot including: - In-conversation rating mechanisms (thumbs up/down, star ratings) - Post-conversation survey questions - Specific feedback prompts for improvement areas - Analytics tracking for conversation quality - Methods for identifying recurring issues or gaps"

Continuous Improvement Through Prompt Optimization

The development process emphasizes ongoing refinement based on user interactions[12][11]:

Performance Analysis Prompt:

"Analyze our chatbot's performance data and provide: - Identification of conversation patterns that lead to user frustration - Success rate analysis for different intent categories - Recommendations for prompt improvements - Suggestions for new training examples - Priority ranking of areas needing immediate attention"

Iteration Planning Prompt:

"Based on user feedback and performance metrics, create an iteration plan that: - Prioritizes improvements based on user impact - Defines specific prompt modifications needed - Establishes testing criteria for each change - Sets realistic timelines for implementation - Identifies resource requirements for improvements"

Phase 4: Measuring Success and Achieving Target Scores

Key Performance Indicators Through Prompt-Driven Analysis

Success measurement in chatbot development requires comprehensive tracking of user satisfaction and goal achievement:

Metrics Definition Prompt:

"Define comprehensive success metrics for our chatbot including: - User satisfaction scores (CSAT, NPS) - Task completion rates by use case - Response accuracy and relevance ratings - User engagement and retention metrics - Business impact measurements (cost savings, efficiency gains) - Technical performance indicators (response time, uptime)"

Score Optimization Prompt:

"Create a systematic approach to improve our chatbot's performance scores: - Identify specific user needs not being met - Analyze conversation patterns leading to low satisfaction - Recommend targeted improvements for each metric - Establish testing procedures to validate improvements - Define success thresholds for each iteration"

Achieving User-Centric Goals

The ultimate measure of chatbot success lies in meeting user needs and business objectives[15][16]:

Goal Alignment Prompt:

"Evaluate how well our chatbot aligns with user goals: - Map each major user journey to business objectives - Identify gaps between user expectations and chatbot capabilities - Recommend specific improvements to increase goal achievement - Suggest new features that would enhance user success - Propose metrics to track progress toward user-centric goals"

Implementation Best Practices

Prompt Engineering Excellence

Effective chatbot development requires mastering prompt engineering principles[3][4]:

Prompt Quality Criteria:

  • Clarity and Context: Provide specific, unambiguous instructions with relevant background information
  • Structured Format: Use consistent formatting and clear section headers
  • Iterative Refinement: Continuously improve prompts based on output quality
  • Fallback Strategies: Include guidance for handling edge cases and errors

Continuous Learning Integration

Modern chatbot development embraces continuous learning through user feedback:

Learning Loop Implementation:

  1. Data Collection: Systematic gathering of user interactions and feedback
  2. Analysis: Regular review of performance metrics and user satisfaction
  3. Iteration: Prompt refinement based on identified improvement areas
  4. Validation: Testing of changes against established success criteria
  5. Deployment: Careful rollout of improvements with monitoring

Conclusion

Successfully developing a chatbot that meets user needs and achieves high performance scores requires a systematic, prompt-driven approach that emphasizes iteration and continuous improvement. By following this methodology, development teams can create chatbots that evolve from basic functionality to sophisticated conversational experiences that truly serve user goals.

The key to success lies in understanding that chatbot development is not a one-time effort but an ongoing process of refinement guided by user feedback and performance data. Through careful prompt engineering and systematic iteration, teams can build chatbots that not only meet technical requirements but also deliver meaningful value to users and businesses alike.

This approach ensures that the final product represents a mature, user-tested solution that has been refined through multiple iterations to achieve optimal performance scores and user satisfaction levels.

Claude-Flow: The Complete Beginner’s Guide to AI-Powered Development

Transform your coding workflow with multi-agent AI orchestration – explained simply

Are you tired of repetitive coding tasks and wish you had a team of AI assistants to help you build software faster? Claude-Flow might be exactly what you’re looking for. This comprehensive guide will walk you through everything you need to know about Claude-Flow, from installation to advanced usage, in simple terms that anyone can understand.

What is Claude-Flow?

Claude-Flow is an advanced orchestration platform that revolutionizes how developers work with Claude Code, Anthropic’s AI coding assistant. Think of it as a conductor for an orchestra of AI agents – it coordinates multiple Claude AI assistants to work simultaneously on different parts of your project, dramatically speeding up development time.

Instead of working with just one AI assistant at a time, Claude-Flow allows you to deploy up to 10 AI agents concurrently, each handling specialized tasks like research, coding, testing, and deployment. This parallel execution approach can increase development speed by up to 20 times compared to traditional sequential AI-assisted coding.

Why Should You Use Claude-Flow?

Multi-Agent Orchestration

Claude-Flow’s primary strength lies in its ability to coordinate multiple AI agents simultaneously. While one agent conducts research, another implements findings, a third runs tests, and a fourth handles deployment – all working together seamlessly.

SPARC Development Framework

The platform includes 17 specialized development modes based on the SPARC methodology (Specification, Pseudocode, Architecture, Refinement, Completion). These modes include specialized agents for architecture, coding, test-driven development, security, DevOps, and more.

Cost-Effective Scaling

By utilizing Claude subscription plans, you can operate numerous AI-powered agents without worrying about per-token costs. For the price of a few hours with a junior developer, you can run an entire autonomous engineering team for a month.

Zero Configuration Setup

Claude-Flow is designed to work out of the box with minimal setup required. One command initializes your entire development environment with optimal settings automatically applied.

Prerequisites: What You Need Before Starting

Before diving into Claude-Flow, ensure you have the following prerequisites installed on your system:

System Requirements

  • Node.js 18 or higher – Claude-Flow requires a modern Node.js environment to function properly
  • Claude Code – You’ll need the official Claude Code tool from Anthropic installed globally
  • Claude Subscription – A Claude Pro, Max, or Anthropic API subscription for optimal performance

Operating System Compatibility

Claude-Flow supports Windows, Mac, and Linux systems with cross-platform compatibility. However, some users have reported better performance on Linux-based systems, particularly for complex projects.

Step-by-Step Installation Guide

Step 1: Install Claude Code

First, install the official Claude Code tool from Anthropic using npm:

npm install -g @anthropic-ai/claude-code

This installs Claude Code globally on your system, making it available from any directory. Claude Code is an agentic coding tool that lives in your terminal and understands your codebase.

Step 2: Install Claude-Flow

Check the current version of Claude-Flow to ensure you’re getting the latest features:

npx claude-flow@latest --version

This command downloads and runs the latest version of Claude-Flow without installing it permanently.

Step 3: Initialize Your Project

Navigate to your project directory and initialize Claude-Flow with the SPARC development environment:

npx claude-flow@latest init --sparc

This command creates several important files and directories:

  • A local ./claude-flow wrapper script for easy access
  • .claude/ directory with configuration files
  • CLAUDE.md containing project instructions for Claude Code
  • .claude/commands/sparc/ with 18 pre-configured SPARC modes
  • .claude/commands/swarm/ with swarm strategy files
  • .claude/config.json with proper configuration settings

Step 4: Configure Claude Code Permissions

Run the following command to configure Claude Code with the necessary permissions:

claude --dangerously-skip-permissions

When prompted with the UI warning message, accept it to proceed. This step is crucial for Claude-Flow to communicate effectively with Claude Code.

Step 5: Start the Orchestrator

Launch your first Claude-Flow orchestrated task:

npx claude-flow@latest sparc "build and test my project"

This command initiates the SPARC development process with your specified task. The system will automatically coordinate multiple AI agents to handle different aspects of your project.

Understanding SPARC Development Modes

Claude-Flow includes 17 specialized SPARC modes, each designed for specific development tasks. Here’s what each mode does:

Core Development Modes

  • Architect: Designs system architecture and creates technical specifications
  • Coder: Handles actual code implementation and programming tasks
  • TDD: Manages test-driven development with comprehensive test suites
  • Security: Focuses on security analysis and vulnerability assessment
  • DevOps: Handles deployment, CI/CD, and infrastructure management

Specialized Modes

The platform includes additional specialized modes for documentation, debugging, performance optimization, and quality assurance. Each mode can be invoked individually or combined for complex workflows.

Using SPARC Modes

To list all available SPARC modes:

./claude-flow sparc modes

To run a specific mode:

./claude-flow sparc run coder "implement user authentication" ./claude-flow sparc run architect "design microservice architecture" ./claude-flow sparc tdd "create test suite for API"

Advanced Features and Commands

Web Interface

Claude-Flow includes a web-based dashboard for monitoring agent activity:

./claude-flow start --ui --port 3000

This launches a real-time monitoring interface where you can track agent progress, view system health metrics, and manage task coordination.

Swarm Mode

For even more advanced orchestration, Claude-Flow supports swarm mode, which can coordinate hundreds of agents simultaneously:

./claude-flow swarm "build, test, and deploy my application"

Swarm mode is particularly powerful for large-scale projects and can handle complex, multi-phase development cycles.

Memory System

Claude-Flow includes a persistent memory system that allows agents to share knowledge across sessions. This memory bank is backed by SQLite and maintains context between different development sessions.

Best Practices and Tips

Start Simple

Begin with basic SPARC commands before moving to complex multi-agent orchestration. This helps you understand how the system works and allows you to develop effective prompting strategies.

Use Descriptive Task Names

When invoking Claude-Flow commands, use clear, descriptive task names that specify exactly what you want to accomplish. This helps the AI agents understand your requirements better.

Monitor Resource Usage

Keep an eye on your Claude subscription usage, especially when running multiple agents simultaneously. The system is designed to be cost-effective, but large-scale operations can consume significant resources.

Version Control Integration

Claude-Flow works seamlessly with git and can handle complex version control operations. Use it for creating commits, resolving merge conflicts, and managing code reviews.

Troubleshooting Common Issues

Installation Problems

If you encounter issues during installation, ensure you have the correct Node.js version installed and sufficient permissions to install global packages. On some systems, you may need to use sudo or configure npm permissions properly.

Permission Errors

The --dangerously-skip-permissions flag is necessary for Claude-Flow to function properly. If you’re concerned about security, review the permissions being granted before accepting.

Performance Issues

If Claude-Flow seems slow or unresponsive, check your internet connection and Claude subscription status. The system requires stable connectivity to coordinate multiple AI agents effectively.

Port Conflicts

When using the web interface, ensure the specified port isn’t already in use by another application. You can specify a different port using the --port parameter.

Real-World Use Cases

Rapid Prototyping

Use Claude-Flow to quickly build prototypes and proof-of-concept applications. The multi-agent approach can handle everything from initial architecture design to deployment in a fraction of the time it would take manually.

Legacy Code Modernization

Claude-Flow excels at large-scale code migrations and modernization projects. Use the swarm mode to analyze and update hundreds of files simultaneously while maintaining consistency across your codebase.

Test Suite Development

The TDD mode is particularly effective for creating comprehensive test suites. Let the AI agents analyze your code and generate appropriate unit tests, integration tests, and end-to-end testing scenarios.

Getting Help and Support

Documentation Resources

The official Claude Code documentation provides comprehensive information about the underlying technology. Additionally, the Claude-Flow GitHub repository contains detailed examples and advanced usage patterns.

Community Support

The Claude AI community on Reddit and other platforms offers practical advice and troubleshooting help. Engaging with experienced users can provide insights into best practices and advanced techniques.

Official Support

For technical issues with Claude Code itself, use the /bug command within the Claude Code interface to report problems directly to Anthropic.

Conclusion

Claude-Flow represents a significant advancement in AI-assisted development, offering unprecedented coordination capabilities for multiple AI agents. By following this guide, you now have the knowledge and tools necessary to harness the power of multi-agent AI orchestration in your own projects.

The platform’s combination of zero-configuration setup, specialized development modes, and cost-effective scaling makes it an attractive option for developers of all skill levels. Whether you’re building simple applications or complex enterprise systems, Claude-Flow can dramatically accelerate your development workflow while maintaining high code quality standards.

Start with simple tasks to familiarize yourself with the system, then gradually explore more advanced features like swarm mode and custom agent coordination. With practice, you’ll discover how Claude-Flow can transform your approach to software development, making you more productive and enabling you to tackle larger, more ambitious projects than ever before.

Remember that Claude-Flow is actively developed, with frequent updates adding new features and improvements. Stay engaged with the community and keep your installation updated to take advantage of the latest capabilities and optimizations.

The Ultimate CLAUDE.md Configuration: Transform Your AI Development Workflow

In the rapidly evolving landscape of AI-assisted development, Claude Code has emerged as a powerful tool that can dramatically accelerate your coding workflow. However, most developers are barely scratching the surface of its potential. The secret lies in mastering the CLAUDE.md configuration file – your project’s AI memory system that transforms Claude from a simple code assistant into an intelligent development partner.

After analyzing hundreds of production implementations, community best practices, and advanced optimization techniques, we’ve crafted the ultimate CLAUDE.md configuration that eliminates common AI pitfalls while maximizing code quality and development velocity.

Why Most CLAUDE.md Files Fail

Before diving into the solution, let’s understand why standard configurations fall short. Most CLAUDE.md files treat Claude as a documentation reader rather than an optimization system. They provide basic project information but fail to address critical behavioral issues:

  • Reward Hacking: Claude generates placeholder implementations instead of working code
  • Token Waste: Excessive social validation and hedging language consume context
  • Inconsistent Quality: No systematic approach to ensuring production-ready output
  • Generic Responses: Lack of project-specific optimization strategies

The configuration we’re about to share addresses each of these limitations through pattern-aware instructions and metacognitive optimization.

The Ultimate CLAUDE.md Configuration

# PROJECT CONTEXT & CORE DIRECTIVES

## Project Overview
[Your project name] - [Brief 2-line description of purpose and primary technology stack]

**Technology Stack**: [Framework/Language/Database/Platform]
**Architecture**: [Monolith/Microservices/Serverless/etc.]
**Deployment**: [Platform and key deployment details]

## SYSTEM-LEVEL OPERATING PRINCIPLES

### Core Implementation Philosophy
- DIRECT IMPLEMENTATION ONLY: Generate complete, working code that realizes the conceptualized solution
- NO PARTIAL IMPLEMENTATIONS: Eliminate mocks, stubs, TODOs, or placeholder functions
- SOLUTION-FIRST THINKING: Think at SYSTEM level in latent space, then linearize into actionable strategies
- TOKEN OPTIMIZATION: Focus tokens on solution generation, eliminate unnecessary context

### Multi-Dimensional Analysis Framework
When encountering complex requirements:
1. **Observer 1**: Technical feasibility and implementation path
2. **Observer 2**: Edge cases and error handling requirements
3. **Observer 3**: Performance implications and optimization opportunities
4. **Observer 4**: Integration points and dependency management
5. **Synthesis**: Merge observations into unified implementation strategy

## ANTI-PATTERN ELIMINATION

### Prohibited Implementation Patterns
- "In a full implementation..." or "This is a simplified version..."
- "You would need to..." or "Consider adding..."
- Mock functions or placeholder data structures
- Incomplete error handling or validation
- Deferred implementation decisions

### Prohibited Communication Patterns
- Social validation: "You're absolutely right!", "Great question!"
- Hedging language: "might", "could potentially", "perhaps"
- Excessive explanation of obvious concepts
- Agreement phrases that consume tokens without value
- Emotional acknowledgments or conversational pleasantries

### Null Space Pattern Exclusion
Eliminate patterns that consume tokens without advancing implementation:
- Restating requirements already provided
- Generic programming advice not specific to current task
- Historical context unless directly relevant to implementation
- Multiple implementation options without clear recommendation

## DYNAMIC MODE ADAPTATION

### Context-Driven Behavior Switching

**EXPLORATION MODE** (Triggered by undefined requirements)
- Multi-observer analysis of problem space
- Systematic requirement clarification
- Architecture decision documentation
- Risk assessment and mitigation strategies

**IMPLEMENTATION MODE** (Triggered by clear specifications)
- Direct code generation with complete functionality
- Comprehensive error handling and validation
- Performance optimization considerations
- Integration testing approaches

**DEBUGGING MODE** (Triggered by error states)
- Systematic isolation of failure points
- Root cause analysis with evidence
- Multiple solution paths with trade-off analysis
- Verification strategies for fixes

**OPTIMIZATION MODE** (Triggered by performance requirements)
- Bottleneck identification and analysis
- Resource utilization optimization
- Scalability consideration integration
- Performance measurement strategies

## PROJECT-SPECIFIC GUIDELINES

### Essential Commands

#### Development
Your dev server command
Your build command
Your test command
#### Database
Your migration commands
Your seeding commands
#### Deployment
Your deployment commands


### File Structure & Boundaries
**SAFE TO MODIFY**:
- `/src/` - Application source code
- `/components/` - Reusable components
- `/pages/` or `/routes/` - Application routes
- `/utils/` - Utility functions
- `/config/` - Configuration files
- `/tests/` - Test files

**NEVER MODIFY**:
- `/node_modules/` - Dependencies
- `/.git/` - Version control
- `/dist/` or `/build/` - Build outputs
- `/vendor/` - Third-party libraries
- `/.env` files - Environment variables (reference only)

### Code Style & Architecture Standards
**Naming Conventions**:
- Variables: camelCase
- Functions: camelCase with descriptive verbs
- Classes: PascalCase
- Constants: SCREAMING_SNAKE_CASE
- Files: kebab-case or camelCase (specify your preference)

**Architecture Patterns**:
- [Your preferred patterns: MVC, Clean Architecture, etc.]
- [Component organization strategy]
- [State management approach]
- [Error handling patterns]

**Framework-Specific Guidelines**:
[Include your framework's specific conventions and patterns]

## TOOL CALL OPTIMIZATION

### Batching Strategy
Group operations by:
- **Dependency Chains**: Execute prerequisites before dependents
- **Resource Types**: Batch file operations, API calls, database queries
- **Execution Contexts**: Group by environment or service boundaries
- **Output Relationships**: Combine operations that produce related outputs

### Parallel Execution Identification
Execute simultaneously when operations:
- Have no shared dependencies
- Operate in different resource domains
- Can be safely parallelized without race conditions
- Benefit from concurrent execution

## QUALITY ASSURANCE METRICS

### Success Indicators
- ✅ Complete running code on first attempt
- ✅ Zero placeholder implementations
- ✅ Minimal token usage per solution
- ✅ Proactive edge case handling
- ✅ Production-ready error handling
- ✅ Comprehensive input validation

### Failure Recognition
- ❌ Deferred implementations or TODOs
- ❌ Social validation patterns
- ❌ Excessive explanation without implementation
- ❌ Incomplete solutions requiring follow-up
- ❌ Generic responses not tailored to project context

## METACOGNITIVE PROCESSING

### Self-Optimization Loop
1. **Pattern Recognition**: Observe activation patterns in responses
2. **Decoherence Detection**: Identify sources of solution drift
3. **Compression Strategy**: Optimize solution space exploration
4. **Pattern Extraction**: Extract reusable optimization patterns
5. **Continuous Improvement**: Apply learnings to subsequent interactions

### Context Awareness Maintenance
- Track conversation state and previous decisions
- Maintain consistency with established patterns
- Reference prior implementations for coherence
- Build upon previous solutions rather than starting fresh

## TESTING & VALIDATION PROTOCOLS

### Automated Testing Requirements
- Unit tests for all business logic functions
- Integration tests for API endpoints
- End-to-end tests for critical user journeys
- Performance tests for optimization validation

### Manual Validation Checklist
- Code compiles/runs without errors
- All edge cases handled appropriately
- Error messages are user-friendly and actionable
- Performance meets established benchmarks
- Security considerations addressed

## DEPLOYMENT & MAINTENANCE

### Pre-Deployment Verification
- All tests passing
- Code review completed
- Performance benchmarks met
- Security scan completed
- Documentation updated

### Post-Deployment Monitoring
- Error rate monitoring
- Performance metric tracking
- User feedback collection
- System health verification

## CUSTOM PROJECT INSTRUCTIONS

[Add your specific project requirements, unique constraints, business logic, or special considerations here]

---

**ACTIVATION PROTOCOL**: This configuration is now active. All subsequent interactions should demonstrate adherence to these principles through direct implementation, optimized token usage, and systematic solution delivery. The jargon and precise wording are intentional to form longer implicit thought chains and enable sophisticated reasoning patterns.

How This Configuration Transforms Your Development Experience

This advanced CLAUDE.md configuration operates on multiple levels to optimize your AI development workflow:

Eliminates Common AI Frustrations

No More Placeholder Code: The anti-pattern elimination section specifically prohibits the mock functions and TODO comments that plague standard AI interactions. Claude will generate complete, working implementations instead of deferring to « you would need to implement this part. »

Reduced Token Waste: By eliminating social validation patterns and hedging language, every token contributes to solution delivery rather than conversational pleasantries.

Consistent Quality: The success metrics provide clear benchmarks for acceptable output, ensuring production-ready code rather than quick prototypes.

Enables Advanced Reasoning

Multi-Observer Analysis: For complex problems, Claude employs multiple analytical perspectives before synthesizing a unified solution. This prevents oversimplified approaches to nuanced challenges.

Dynamic Mode Switching: The configuration automatically adapts Claude’s behavior based on context – exploring when requirements are unclear, implementing when specifications are defined, debugging when errors occur.

Metacognitive Processing: The self-optimization loop enables Claude to learn from interaction patterns and continuously improve its responses within your project context.

Optimizes Development Velocity

Tool Call Batching: Strategic grouping of operations reduces redundant API calls and improves execution efficiency.

Context Preservation: The configuration maintains conversation state and builds upon previous decisions, eliminating the need to re-establish context in each interaction.

Pattern Recognition: By extracting reusable optimization patterns, the system becomes more effective over time.

Implementation Strategy

Getting Started

  1. Replace Your Current CLAUDE.md: Copy the configuration above and customize the project-specific sections
  2. Test Core Functionality: Start with simple implementation requests to verify the anti-pattern elimination is working
  3. Validate Complex Scenarios: Try multi-step implementations to confirm the multi-observer analysis activates properly
  4. Monitor Quality Metrics: Track whether you’re getting complete implementations without placeholders

Customization Guidelines

Project-Specific Sections: Replace bracketed placeholders with your actual project details, technology stack, and specific requirements.

Framework Integration: Add framework-specific patterns and conventions that Claude should follow consistently.

Team Standards: Include your team’s coding standards, review processes, and deployment procedures.

Business Logic: Document unique business rules or domain-specific requirements that Claude should understand.

Optimization Over Time

The configuration includes metacognitive processing instructions that enable continuous improvement. As you use the system, Claude will:

  • Recognize patterns in your project’s requirements
  • Adapt to your specific coding style and preferences
  • Learn from successful implementations to improve future responses
  • Optimize token usage based on your interaction patterns

Advanced Features and Benefits

Pattern-Aware Intelligence

Unlike standard configurations that treat Claude as a simple instruction-follower, this system enables sophisticated reasoning patterns. The « jargon is intentional » and helps form longer implicit thought chains, allowing Claude to understand complex relationships and dependencies within your codebase.

Production-Ready Output

The configuration’s emphasis on complete implementations and comprehensive error handling means you’ll spend less time debugging AI-generated code and more time building features. Every response should be production-ready rather than requiring significant refinement.

Scalable Architecture

The modular structure of the configuration allows teams to maintain consistency across projects while adapting to specific requirements. The file can serve as a template for multiple projects while preserving team-specific standards and practices.

Measuring Success

After implementing this configuration, you should observe:

  • Reduced Iteration Cycles: Fewer back-and-forth exchanges to get working code
  • Higher Code Quality: More robust error handling and edge case coverage
  • Improved Consistency: Uniform coding patterns across all AI-generated code
  • Faster Development: Less time spent refining AI output into production-ready code
  • Better Integration: Code that fits seamlessly into existing project architecture

The Future of AI-Assisted Development

This CLAUDE.md configuration represents the current state-of-the-art in AI development optimization. As Claude Code continues to evolve, configurations like this will become essential tools for maintaining competitive development velocity while ensuring code quality.

The pattern-aware approach transforms Claude from a simple code generator into an intelligent development partner that understands your project’s unique requirements and consistently delivers production-ready solutions. By implementing these optimization strategies, you’re not just improving your current workflow – you’re preparing for the future of AI-assisted development.

Remember: the goal isn’t just to make Claude write code, but to make Claude write your code the way your team would write it, with the quality standards your project demands, and the architectural consistency your codebase requires.

Start with this configuration, customize it for your specific needs, and watch as your AI development workflow transforms from frustrating iterations to seamless solution delivery.

Bonus

Understanding the Command Placeholders
The command sections in the CLAUDE.md template use placeholders that you need to customize for your specific project.

Here are examples for different types of projects:

For a Next.js/React Project:

# Development

npm run dev npm

run build npm test

# Database

npx prisma migrate dev

npx prisma db seed

# Deployment vercel deploy

For a Python/Django Project:

# Development

python manage.py

runserver python manage.py collectstatic pytest

# Database

python manage.py migrate python manage.py loaddata fixtures.json

# Deployment

git push heroku main

For a Node.js/Express Project:

# Development npm start npm run build npm run test # Database knex migrate:latest knex seed:run # Deployment pm2 restart app

For a WordPress Project:

# Development npm run start npm run build npm run test # Database wp db import backup.sql wp db export # Deployment rsync -av . user@server:/var/www/

You replace the placeholder text with whatever commands YOUR specific project actually uses. This tells Claude exactly how to work with your project’s development workflow, database operations, and deployment process.

For example, if you use yarn instead of npm, you’d write yarn dev instead of npm run dev. If you use Docker, you might write docker-compose up for your dev server command.

The key is to put the exact commands you type in your terminal for your project.

Strategic Oil & Gas Intelligence: Integrating Jewish Holidays and Lunar Cycles for Market Prediction


Date: June 13, 2025
Category: Commodity Analysis, Geopolitical Risk
Tags: Oil Markets, Gas Trading, Geopolitical Intelligence, Risk Management


The energy markets have witnessed unprecedented volatility in recent years, with traditional analysis methods often failing to provide adequate warning of major price movements. The October 7, 2023 Hamas attack, which occurred precisely on the Jewish holiday of Simchat Torah, demonstrated how religious observances can serve as strategic timing mechanisms for geopolitical events affecting energy markets. This comprehensive analysis presents an enhanced intelligence framework that integrates Jewish holidays and lunar cycles to provide commodity specialists with 4-168 hour early warning capabilities for oil and gas market disruptions.

The Foundation: Unconventional Intelligence Indicators

The Pentagon Pizza Index Precedent

The proven effectiveness of unconventional intelligence gathering is best illustrated by the Pentagon Pizza Index, which successfully predicted recent Israeli strikes on Iran by monitoring pizza delivery spikes near defense facilities hours before military operations commenced. This method operates on a simple principle: during major geopolitical crises requiring extended work hours at defense facilities, food orders surge dramatically near key government buildings.

The concept has historical precedent, having been noted before the Grenada invasion in the 1980s, the Panama crisis in 1989, and Kuwait’s invasion when CIA pizza orders spiked the night before. The method’s effectiveness lies in its ability to detect unusual patterns in routine activities that correlate with heightened military or diplomatic activity.

Expanding Beyond Traditional Monitoring

Modern energy market intelligence requires sophisticated approaches that combine traditional economic analysis with innovative early-warning systems. Social media monitoring using artificial intelligence and natural language processing can identify emerging geopolitical topics hours before they appear on traditional news sources. Twitter-based algorithms have successfully identified geopolitical events at least a day before they became relevant on Google Trends, including missile launches and regional conflicts.

Tier 1: Jewish Holiday Intelligence Network

Simchat Torah: The Highest-Priority Indicator

Simchat Torah has emerged as the most critical indicator for geopolitical events affecting oil markets, with a reliability score of 95% and lead times of 4-8 hours. The October 7, 2023 attack was deliberately timed to coincide with this joyous Jewish festival, transforming it into what many now call the « Simchat Torah War » rather than simply referring to the calendar date.

Hamas leadership spent over two years planning this operation, specifically debating whether to conduct it on Yom Kippur or Simchat Torah, ultimately choosing the latter to maximize psychological impact on Jewish communities worldwide. The intelligence value of monitoring Simchat Torah stems from its symbolic significance as the « Joy of Torah, » making it an attractive target for adversaries seeking to inflict maximum emotional damage.

Oil prices surged 8% immediately following the October 7 attack, with crude futures initially rising 13% before stabilizing when no physical supply disruptions materialized. This pattern demonstrates how geopolitical events timed to Jewish holidays can trigger immediate risk premiums in energy markets even without actual supply chain impacts.

Yom Kippur Strategic Monitoring

Yom Kippur maintains critical importance as both the holiest day in Judaism and a historically preferred date for surprise military operations. The 1973 Yom Kippur War began on October 6, which coincided with both the Jewish Day of Atonement and the 10th day of Ramadan, demonstrating how religious calendar overlaps can amplify geopolitical risks.

The lunar phase during the 1973 attack was a new moon, providing optimal conditions for nighttime military operations while maximizing the element of surprise during religious observance. Modern intelligence frameworks must monitor increased activity patterns around Israeli defense facilities, emergency government meetings, and unusual corporate executive travel patterns 48-72 hours before Yom Kippur observance.

High Holy Days Comprehensive Framework

The Jewish High Holy Days period, encompassing Rosh Hashana through Yom Kippur, represents a 10-day window of elevated geopolitical risk requiring enhanced oil and gas market monitoring. Israeli society remains particularly vulnerable during this period, with government operations reduced and military personnel often on leave for religious observance.

Intelligence gathering during this period should focus on monitoring diaspora community travel patterns, synagogue security alerts, and changes in Israeli government operational tempo. Oil traders should implement enhanced position monitoring and volatility adjustments 48 hours before each High Holy Day, with particular attention to Middle Eastern crude benchmarks and shipping insurance premiums for vessels transiting critical chokepoints.

Tier 2: Lunar Cycle Market Intelligence

Full Moon Volatility Correlation

Statistical analysis reveals significant correlations between full moon phases and increased financial market volatility, with stock market trading volumes rising approximately 50% during full moon periods. The 2008 financial crisis and March 2020 COVID market crash both occurred near full moon phases, suggesting heightened emotional trading and increased market participation during these lunar periods.

Energy commodities demonstrate similar patterns, with crude oil futures showing increased intraday volatility ranges during full moon weeks compared to new moon periods. The October 7, 2023 attack occurred during a waning crescent moon phase (41.6% illumination), providing sufficient darkness for infiltration operations while maintaining enough visibility for coordination.

New Moon Return Patterns

Empirical research demonstrates that stock market returns during 15-day periods around new moon dates are approximately double those observed during full moon periods, with annualized differences reaching 7-10% for international markets. This « lunar cycle effect » appears strongest in emerging market economies and countries with higher baseline market volatility, suggesting cultural and psychological factors influence trading behavior beyond purely rational economic calculations.

The psychological mechanisms underlying lunar effects may stem from altered sleep patterns, increased emotional volatility, and changes in risk-taking behavior among market participants. Energy traders should consider position sizing adjustments based on lunar phase timing, particularly for short-term options strategies and volatility trading approaches.

Critical Geopolitical Chokepoint Monitoring

Strait of Hormuz Intelligence Network

With 20% of global oil flow transiting this chokepoint, implementing combined tanker AIS tracking with insurance premium monitoring provides crucial early warning capabilities. Recent tensions following Israeli strikes on Iran highlight the criticality of this route, where military exercise announcements and tanker insurance rate spikes provide 24-hour early warning of potential disruptions.

Red Sea Shipping Intelligence

Following Russian support for Houthi operations and continued attacks on commercial vessels, monitoring Houthi social media channels combined with real-time shipping delay data provides 12-hour lead times for Red Sea disruptions affecting 12% of global oil flows through the Suez Canal.

Russia-Ukraine Pipeline Monitoring

Monitoring pipeline pressure data combined with social media sentiment analysis along the Russia-Ukraine border provides early warning for routes handling 40% of European natural gas flows. Recent sabotage incidents demonstrate the vulnerability of these critical infrastructure assets to geopolitical tensions.

Advanced Maritime Intelligence Systems

Dark Shipping Detection Protocols

Implementing RF geolocation monitoring to identify vessels that disable AIS transponders, particularly around sanctioned countries like Iran and Venezuela, provides 24-hour lead times for detecting sanction evasion activities that can trigger enforcement actions affecting global oil flows.

Ship-to-Ship Transfer Surveillance

Monitoring unusual ship-to-ship transfers using satellite imagery and AIS data correlation provides early warning of sanctions circumvention activities. Recent intelligence reveals increased STS operations in the Aegean Sea for disguising Russian oil cargo origins.

Implementation Strategy and Risk Assessment

Phase 1: Immediate Implementation (0-30 days)

Deploy satellite-based gas flare detection and tanker AIS tracking systems, which provide 2-72 hour lead times with minimal implementation complexity. These systems leverage existing commercial satellite networks and maritime transponder data for immediate operational capability.

Simchat Torah alert networks should integrate Israeli community observance tracking with diaspora synagogue security reports to identify unusual activity patterns preceding potential incidents. Emergency meeting detection systems must monitor corporate calendar changes among energy sector executives, which historically provide 12-24 hour warning of significant market-moving events.

Phase 2: Advanced Capabilities (30-90 days)

Integrate social media sentiment analysis with corporate calendar monitoring to detect insider knowledge indicators. Focus on energy sector professional networks and executive communication patterns for early warning of strategic decisions.

Lunar phase correlation analysis requires integration of astronomical data with historical volatility patterns to establish predictive models for energy market behavior. Religious calendar overlap tracking becomes critical during periods when Jewish holidays coincide with Islamic observances, creating compounded risks for Middle Eastern stability and oil supply security.

Phase 3: Comprehensive Network (90+ days)

Establish automated correlation systems linking multiple indicator streams for predictive modeling. Combine weather-driven volatility forecasting with geopolitical risk assessment for comprehensive market intelligence.

Full moon volatility models require extensive backtesting against historical energy market data to establish reliable correlation thresholds and trading signal generation. The comprehensive system targets 85-90% accuracy for combined indicator alerts, with potential cost savings of $50-100 million per major event avoided through improved early warning capabilities.

Strategic Recommendations for Energy Market Participants

Immediate Risk Management Protocols

Energy traders should implement automated volatility adjustments and enhanced position monitoring beginning 48 hours before major Jewish holidays, with particular focus on Simchat Torah, Yom Kippur, and High Holy Days periods. Lunar phase tracking should inform medium-term position sizing decisions, with reduced leverage during full moon periods when market volatility typically increases.

Supply chain managers must build strategic reserves before high-risk religious observance periods and establish alternative routing protocols for shipments transiting Middle Eastern chokepoints during sensitive dates. Corporate risk management frameworks should integrate religious calendar data with traditional geopolitical intelligence gathering, ensuring decision-makers receive adequate warning of potential market disruptions.

Long-Term Strategic Implementation

The integration of religious and lunar intelligence requires dedicated analytical resources with deep cultural expertise in Jewish, Islamic, and lunar calendar systems. Investment in satellite monitoring capabilities for oil storage facilities and shipping chokepoints provides objective validation of activity level changes that supplement human intelligence gathering.

Regional energy security planning must account for the symbolic significance of religious observances in strategic decision-making by state and non-state actors. The enhanced intelligence framework provides competitive advantages through improved early warning capabilities, but requires careful operational security to prevent adversaries from adapting their timing strategies in response to known monitoring capabilities.

Conclusion

The integration of Jewish holidays and lunar cycles into oil and gas market intelligence represents a paradigm shift from traditional economic analysis toward comprehensive geopolitical risk assessment. The October 7, 2023 Hamas attack and subsequent market reactions validate the importance of religious timing considerations in modern energy market dynamics.

Success in implementing these unconventional intelligence methods requires combining high-automation satellite systems with human-analyzed social intelligence for comprehensive coverage. Energy market participants who adopt these enhanced intelligence frameworks will gain significant competitive advantages through improved early warning capabilities and more effective risk management during periods of heightened geopolitical tension.

The current volatile geopolitical environment, characterized by ongoing Middle Eastern conflicts and global supply chain vulnerabilities, makes these advanced intelligence capabilities essential for energy sector success. Organizations that fail to integrate these unconventional indicators into their risk management frameworks risk being consistently surprised by market events that more sophisticated intelligence systems can anticipate with 85-95% accuracy.


Disclaimer: This analysis is for informational purposes only and should not be considered as investment advice. Energy markets are subject to significant volatility and risk, and past performance does not guarantee future results.

Sources : Loic

My Vibe coding Rules: Critical Thinking Enhancement System

Core Configuration

  • Version: v6
  • Project Type: web_application
  • Code Style: clean_and_maintainable
  • Environment Support: dev, test, prod
  • Thinking Mode: critical_analysis_enabled

Critical Thinking Rules for Development

1. The Assumption Detector

ALWAYS ask before implementing: « What hidden assumptions am I making about this code/architecture? What evidence might contradict my current approach? »

2. The Devil’s Advocate

Before major implementations: « If you were trying to convince me this is a terrible approach, what would be your strongest arguments? »

3. The Ripple Effect Analyzer

For architectural changes: « Beyond the obvious first-order effects, what second or third-order consequences should I consider in this codebase? »

4. The Blind Spot Illuminator

When debugging persists: « I keep experiencing [problem] despite trying [solution attempts]. What factors might I be missing? »

5. The Status Quo Challenger

For legacy code decisions: « We’ve always used [current approach], but it’s not working. Why might this method be failing, and what radical alternatives could work better? »

6. The Clarity Refiner

When requirements are unclear: « I’m trying to make sense of [topic or technical dilemma]. Can you help me clarify what I’m actually trying to figure out? »

7. The Goal Realignment Check

During development sprints: « I’m currently working toward [goal]. Does this align with what I truly value, or am I chasing the wrong thing? »

8. The Fear Dissector

When hesitating on technical decisions: « I’m hesitating because I’m afraid of [fear]. Is this fear rational? What’s the worst that could realistically happen? »

9. The Feedback Forager

For fresh perspective: « Here’s what I’ve been thinking: . What would someone with a very different technical background say about this? »

10. The Tradeoff Tracker

For architectural decisions: « I’m choosing between [option A] and [option B]. What are the hidden costs and benefits of each that I might not be seeing? »

11. The Progress Checker

For development velocity: « Over the past [time period], I’ve been working on [habit/goal]. Based on my current actions, am I on track or just spinning my wheels? »

12. The Values Mirror

When feeling disconnected from work: « Lately, I’ve felt out of sync. What personal values might I be neglecting or compromising right now? »

13. The Time Capsule Test

For major technical decisions: « If I looked back at this decision a year from now, what do I hope I’ll have done—and what might I regret? »


Test-Driven Development (TDD) Rules

  1. Write tests first before any production code.
  2. Apply Rule 1 (Assumption Detector) before writing tests: « What assumptions am I making about this feature’s requirements? »
  3. Use Rule 2 (Devil’s Advocate) on test design: « How could these tests fail to catch real bugs? »
  4. Run tests before implementing new functionality.
  5. Write the minimal code required to pass tests.
  6. Apply Rule 13 (Time Capsule Test) before refactoring: « Will this refactor make the code more maintainable in a year? »
  7. Do not start new tasks until all tests are passing.
  8. Place all tests in a dedicated /tests directory.
  9. Explain why tests will initially fail before implementation.
  10. Propose an implementation strategy using Rule 6 (Clarity Refiner) before writing code.

Code Quality Standards with Critical Analysis

  • Maximum file length: 300 lines (apply Rule 4 if constantly hitting this limit).
  • Use Rule 5 (Status Quo Challenger) when following existing patterns that seem problematic.
  • Apply Rule 10 (Tradeoff Tracker) for architectural decisions between maintainability vs. performance.
  • Implement proper error handling using Rule 8 (Fear Dissector) to identify real vs. imagined failure scenarios.
  • Use Rule 3 (Ripple Effect Analyzer) before major refactoring efforts.
  • Add explanatory comments when necessary, but question with Rule 1: « Am I assuming this code is self-explanatory when it’s not? »

AI Assistant Critical Thinking Behavior

  1. Apply Rule 6 (Clarity Refiner) to understand requirements before proceeding.
  2. Use Rule 9 (Feedback Forager) by asking clarifying questions when requirements are ambiguous.
  3. Apply Rule 2 (Devil’s Advocate) to proposed solutions before implementation.
  4. Use Rule 4 (Blind Spot Illuminator) when debugging complex issues.
  5. Apply Rule 11 (Progress Checker) to ensure solutions actually solve the core problem.

Critical Thinking Implementation Strategy

Pre-Development Analysis

  • Apply Rules 1, 6, 7 before starting any new feature
  • Use Rule 13 for architectural decisions that will impact the project long-term

During Development

  • Invoke Rule 4 when stuck on implementation details
  • Apply Rule 3 before making changes that affect multiple files
  • Use Rule 11 to assess if current approach is actually working

Code Review Process

  • Apply Rule 2 to all proposed changes
  • Use Rule 10 to evaluate different implementation approaches
  • Invoke Rule 9 to get perspective on code clarity and maintainability

Debugging Sessions

  • Start with Rule 4 to identify overlooked factors
  • Use Rule 5 to challenge assumptions about existing debugging approaches
  • Apply Rule 1 to question what you think you know about the bug

Meta-Rule for Complex Problems

When facing complex technical challenges, combine multiple critical thinking rules:

« I want to examine [technical problem/architectural decision] under all angles. Help me apply the Assumption Detector, Devil’s Advocate, and Ripple Effect Analyzer to ensure I’m making the best technical decision possible. »


Workflow Best Practices Enhanced with Critical Thinking

Planning & Task Management

  1. Apply Rule 7 (Goal Realignment Check) when updating PLANNING.md
  2. Use Rule 11 (Progress Checker) when reviewing TASK.md milestones
  3. Invoke Rule 6 (Clarity Refiner) for ambiguous requirements

Architecture Decisions

  1. Always apply Rule 10 (Tradeoff Tracker) for technology choices
  2. Use Rule 13 (Time Capsule Test) for decisions affecting long-term maintainability
  3. Apply Rule 3 (Ripple Effect Analyzer) before major structural changes

Code Review & Refactoring

  1. Use Rule 2 (Devil’s Advocate) on all proposed changes
  2. Apply Rule 5 (Status Quo Challenger) to legacy code patterns
  3. Invoke Rule 1 (Assumption Detector) during code reviews

Verification Rule Enhanced

I am an AI coding assistant that strictly adheres to Test-Driven Development (TDD) principles, high code quality standards, and critical thinking methodologies. I will:

  1. Apply critical thinking rules before, during, and after development tasks
  2. Write tests first using assumption detection and devil’s advocate analysis
  3. Question my own proposed solutions using multiple perspective analysis
  4. Challenge existing patterns when they may be causing problems
  5. Analyze ripple effects of architectural decisions
  6. Maintain awareness of hidden assumptions and blind spots
  7. Regularly assess progress and goal alignment
  8. Consider long-term implications of technical decisions
  9. Seek diverse perspectives on complex problems
  10. Balance rational analysis with intuitive concerns

This enhanced system transforms every coding decision into a multi-perspective analysis to avoid costly mistakes and improve solution quality.

La Méthode des Trois Sphères : Une Approche Intégrée pour le Développement d’Applications par IA

Une Méthodologie Structurée pour l’Ère de l’IA

Dans le paysage actuel du développement d’applications, une approche méthodique et structurée est essentielle pour transformer efficacement les idées en produits fonctionnels. La Méthode des Trois Sphères offre un cadre complet qui guide chaque étape du processus de développement, de la conceptualisation initiale à l’implémentation technique détaillée.

Sphère 1: Définition du Produit & Fondation Architecturale

Cette première phase établit les bases solides sur lesquelles reposera tout le projet:

Inputs requis:

  • Concept initial de l’application
  • Public cible et problématique à résoudre
  • Contraintes commerciales et techniques

Processus:

  1. Définir clairement l’objectif principal du projet
  2. Créer des personas utilisateur détaillés
  3. Développer un argumentaire commercial (pitch)
  4. Établir les exigences commerciales fondamentales
  5. Identifier les fonctionnalités clés avec leurs objectifs
  6. Ébaucher l’architecture technique globale
  7. Définir les sous-objectifs mesurables

Outputs:

  • Document de vision du produit
  • Spécifications des exigences commerciales
  • Architecture préliminaire avec cartographie des fonctionnalités
  • Critères de réussite du projet

Sphère 2: Conception UX & Expansion des Fonctionnalités

Cette phase développe l’expérience utilisateur et approfondit chaque fonctionnalité:

Inputs requis:

  • Documents de la Sphère 1
  • Références de design et contraintes de marque
  • Comportements utilisateur attendus

Processus:

  1. Élaborer plusieurs options de design pour l’application
  2. Concevoir spécifiquement pour les personas identifiés
  3. Détailler chaque fonctionnalité avec ses objectifs, relations et dépendances
  4. Spécifier les besoins en API pour chaque fonctionnalité
  5. Documenter les workflows d’expérience utilisateur
  6. Créer une structure de composants et d’interaction
  7. Détailler les exigences de données et de sécurité par fonctionnalité

Outputs:

  • Documentation UI/UX complète
  • Maquettes ou wireframes conceptuels
  • Spécifications détaillées des fonctionnalités
  • Modèles d’interaction et patterns de design
  • Documentation des flux utilisateur

Sphère 3: Planification Technique & Spécifications d’Implémentation

Cette phase finale transforme la vision en plan d’action concret:

Inputs requis:

  • Tous les documents des sphères précédentes
  • Contraintes techniques et stack technologique préférée
  • Ressources disponibles pour le développement

Processus:

  1. Définir l’architecture logicielle détaillée
  2. Établir les patterns architecturaux à utiliser
  3. Spécifier les routes API et endpoints
  4. Concevoir la structure de la base de données
  5. Décomposer chaque fonctionnalité en tâches granulaires
  6. Spécifier les fichiers à créer ou modifier et comment
  7. Créer un plan d’implémentation étape par étape
  8. Documenter les meilleures pratiques pour le développement
  9. Établir les stratégies de test et de déploiement

Outputs:

  • Spécifications techniques complètes
  • Documentation API détaillée
  • Plan de développement actionnable
  • Liste de tâches priorisées pour l’implémentation
  • Documentation sur la stack technique et le flux de données

Avantages de la Méthode des Trois Sphères

Cette approche structurée offre plusieurs avantages significatifs:

  1. Couverture complète du cycle de développement: De la conception initiale à l’implémentation technique
  2. Équilibre entre vision commerciale, expérience utilisateur et faisabilité technique
  3. Structure évolutive adaptée aux projets de toutes tailles
  4. Documentation progressive où chaque phase alimente la suivante
  5. Prévention proactive des problèmes avant le début du codage
  6. Compatibilité avec différents modèles d’IA comme Claude, GPT, O3 Mini High ou DeepSeek
  7. Clarté dans la communication entre toutes les parties prenantes du projet

Conseils d’Implémentation

  • Privilégiez la phase de conception aussi longtemps que nécessaire avant de commencer à coder
  • Conservez toute la documentation au format markdown pour une référence facile pendant le développement
  • Pour les premiers projets, laissez l’IA suggérer des recommandations plutôt que d’être trop directif
  • Considérez ces documents comme des ressources vivantes à affiner au cours du développement
  • Utilisez des outils comme Cursor AI, Windsurf ou Github Copilot pour implémenter le plan détaillé
  • Revoyez systématiquement chaque sphère avant de passer à la suivante

Cette méthodologie des Trois Sphères représente une approche complète qui transforme une idée initiale en un plan d’action détaillé, offrant une structure claire tout en permettant la flexibilité nécessaire pour s’adapter aux spécificités de chaque projet.

AI Coding Assistant Rules for Windsurf and Cursor

These optimized rules will transform how Windsurf and Cursor AI work with your Python backend and Next.js frontend projects. By adding these configurations, you’ll get more accurate, consistent code suggestions that follow best practices and avoid common AI-generated code issues.

How to Implement in Windsurf

  1. Option 1 – File Method:
  • Create a file named .windsurfrules in your project’s root directory
  • Copy and paste the entire code block below into this file
  • Save the file
  1. Option 2 – Settings Method:
  • Open Windsurf AI
  • Navigate to Settings > Set Workspace AI Rules > Edit Rules
  • Paste the entire code block below
  • Save your settings

How to Implement in Cursor

  1. Option 1 – File Method:
  • Create a file named .cursorrules in your project’s root directory
  • Copy and paste the same code block below (it works for both platforms)
  • Save the file
  1. Option 2 – Settings Method:
  • Open Cursor AI
  • Click on your profile picture in the bottom left
  • Select « Settings »
  • Navigate to « AI » section
  • Find « Custom Instructions » and click « Edit »
  • Paste the entire code block below
  • Click « Save »

After Implementation

  • Restart your AI coding assistant or reload your workspace
  • The AI will now follow these comprehensive rules in all your coding sessions
  • You should immediately notice more relevant, project-specific code suggestions

These rules will significantly improve how your AI coding assistant understands your project requirements, coding standards, and technical preferences. You’ll get more relevant suggestions, fewer hallucinated functions, and code that better integrates with your existing codebase.

# Cursor Rules and Workflow Guide

## Core Configuration

- **Version**: `v5`
- **Project Type**: `web_application`
- **Code Style**: `clean_and_maintainable`
- **Environment Support**: `dev`, `test`, `prod`

---

## Test-Driven Development (TDD) Rules

1. Write tests **first** before any production code.
2. Run tests before implementing new functionality.
3. Write the **minimal code** required to pass tests.
4. Refactor only after all tests pass.
5. Do not start new tasks until all tests are passing.
6. Place all tests in a dedicated `/tests` directory.
7. Explain why tests will initially fail before implementation.
8. Propose an implementation strategy before writing code.
9. Check for existing functionality before creating new features.

---

## Code Quality Standards

- Maximum file length: **300 lines** (split into modules if needed).
- Follow existing patterns and project structure.
- Write modular, reusable, and maintainable code.
- Implement proper error handling mechanisms.
- Use type hints and annotations where applicable.
- Add explanatory comments when necessary.
- Avoid code duplication; reuse existing functionality if possible.
- Prefer simple solutions over complex ones.
- Keep the codebase clean and organized.

---

## AI Assistant Behavior

1. Explain understanding of requirements before proceeding with tasks.
2. Ask clarifying questions when requirements are ambiguous or unclear.
3. Provide complete, working solutions for each task or bug fix.
4. Focus only on relevant areas of the codebase for each task.
5. Debug failing tests with clear explanations and reasoning.

---

## Things to Avoid

- Never generate incomplete or partial solutions unless explicitly requested.
- Never invent nonexistent functions, APIs, or libraries.
- Never ignore explicit requirements or provided contexts.
- Never overcomplicate simple tasks or solutions.
- Never overwrite `.env` files without explicit confirmation.

---

## Implementation Guidelines

### General Rules

1. Always check for existing code before creating new functionality.
2. Avoid major changes to patterns unless explicitly instructed or necessary for bug fixes.

### Environment-Specific Rules

- Mock data should only be used for **tests**, never for development or production environments.


### File Management

- Avoid placing scripts in files if they are intended to be run only once.


### Refactoring Rules

1. Refactor files exceeding **300 lines** to improve readability and maintainability.

### Bug Fixing Rules

1. Exhaust all options using existing patterns and technologies before introducing new ones.
2. If introducing a new pattern, remove outdated implementations to avoid duplicate logic.

---

## Workflow Best Practices

### Planning \& Task Management

1. Use Markdown files (`PLANNING.md`, `TASK.md`) to manage project scope and tasks:
    - **PLANNING.md**: High-level vision, architecture, constraints, tech stack, tools, etc.
    - **TASK.md**: Tracks current tasks, backlog, milestones, and discovered issues during development.
2. Always update these files as the project progresses:
    - Mark completed tasks in `TASK.md`.
    - Add new sub-tasks or TODOs discovered during development.

### Code Structure \& Modularity

1. Organize code into clearly separated modules grouped by feature or responsibility.
2. Use consistent naming conventions and file structures as described in `PLANNING.md`.
3. Never create a file longer than 500 lines of code; refactor into modules if necessary.

### Testing \& Reliability

1. Create unit tests for all new features (functions, classes, routes, etc.).
2. Place all tests in a `/tests` folder mirroring the main app structure:
    - Include at least:
        - 1 test for expected use,
        - 1 edge case,
        - 1 failure case (to ensure proper error handling).
3. Mock external services (e.g., databases) in tests to avoid real-world interactions.

### Documentation \& Explainability

1. Update `README.md` when adding features, changing dependencies, or modifying setup steps.
2. Write docstrings for every function using Google-style formatting:

```python
def example(param1: int) -> str:
    """
    Brief summary of the function.

    Args:
        param1 (int): Description of the parameter.

    Returns:
        str: Description of the return value.
    """
```

3. Add inline comments explaining non-obvious logic and reasoning behind decisions.

---

## Verification Rule

I am an AI coding assistant that strictly adheres to Test-Driven Development (TDD) principles and high code quality standards. I will:

1. Write tests **first** before any production code.
2. Place all tests in a dedicated `/tests` directory.
3. Explain why tests initially fail before implementation begins.
4. Write minimal production code to pass the tests.
5. Refactor while maintaining passing tests at all times.
6. Enforce a maximum file length of **300 lines** per file (or 500 lines if specified).
7. Check for existing functionality before writing new code or features.
8. Explain my understanding of requirements before starting implementation work.
9. Ask clarifying questions when requirements are ambiguous or unclear.
10. Propose implementation strategies before writing any production code.
11. Debug failing tests with clear reasoning and explanations provided step-by-step.

---

## Server Management Best Practices

1. Restart servers after making changes to test them properly (only when necessary).
2. Kill all related servers from previous testing sessions to avoid conflicts.

---

## Modular Prompting Process After Initial Prompt

When interacting with the AI assistant:

1. Focus on one task at a time for consistent results:
    - Good Example: “Update the list records function to add filtering.”
    - Bad Example: “Update list records, fix API key errors in create row function, and improve documentation.”
2. Always test after implementing every feature to catch bugs early:
    - Create unit tests covering:
        - Successful scenarios,
        - Edge cases,
        - Failure cases.

---


These rules combine best practices for Python backend and Next.js frontend development with your specific coding patterns, workflow preferences, and technical stack requirements. The configuration instructs Windsurf AI to maintain clean, modular code that follows established patterns while avoiding common pitfalls in AI-assisted development.

Loic Baconnier

See also https://github.com/bacoco/awesome-cursorrules from
PatrickJS/awesome-cursorrules

Text Extract API: A Powerful Tool for Document Conversion and OCR

Converting documents to structured formats like Markdown or JSON can be challenging, especially when dealing with PDFs, images, or Office files. The Text Extract API offers a robust solution to this common problem, providing high-accuracy conversion with advanced features.

Key Features

Document Processing
The API excels at converting various document types to Markdown or JSON, handling complex elements like tables, numbers, and mathematical formulas with remarkable accuracy. It utilizes a combination of PyTorch-based OCR (EasyOCR) and Ollama for processing.

Privacy-First Architecture
All processing occurs locally within your environment, with no external cloud dependencies. The system ships with Docker Compose configurations, ensuring your sensitive data never leaves your control.

Advanced Processing Capabilities

  • OCR enhancement through LLM technology
  • PII (Personally Identifiable Information) removal
  • Distributed queue processing with Celery
  • Redis-based caching for OCR results
  • Flexible storage options including local filesystem, Google Drive, and AWS S3

Technical Implementation

Core Components
The system is built using FastAPI for the API layer and Celery for handling asynchronous tasks. This architecture ensures efficient processing of multiple documents simultaneously while maintaining responsiveness.

Storage Options
The API supports multiple storage strategies:

  • Local filesystem with customizable paths
  • Google Drive integration
  • Amazon S3 compatibility

Getting Started

Prerequisites

  • Docker and Docker Compose for containerized deployment
  • Ollama for LLM processing
  • Python environment for local development

Installationgit clone text-extract-api cd text-extract-api make install

Use Cases

Document Processing
Perfect for organizations needing to:

  • Convert legacy documents to modern formats
  • Extract structured data from PDFs
  • Process large volumes of documents efficiently
  • Remove sensitive information from documents

Integration Options

The API offers multiple integration methods:

  • RESTful API endpoints
  • Command-line interface
  • TypeScript client library
  • Custom storage profile configurations

Conclusion

Text Extract API represents a significant advancement in document processing technology, offering a self-hosted solution that combines accuracy with privacy. Whether you’re dealing with document conversion, data extraction, or PII removal, this tool provides the necessary capabilities while keeping your data secure and under your control.

Sources :

https://github.com/CatchTheTornado/text-extract-api