skills/skillxiv-v0.0.2-claude-opus-4.6/chain-of-mindset-adaptive-reasoning/SKILL.md
Enable language models to dynamically switch between four cognitive modes (spatial, convergent, divergent, algorithmic) during problem-solving. Meta-agent observes state and selects optimal mode per step, improving reasoning across math, coding, and spatial tasks without requiring model training.
npx skillsauth add ADu2021/skillXiv chain-of-mindset-adaptive-reasoningInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Single problem-solving strategies fail across diverse task types. Mathematical derivations need convergent logic; creative ideation needs divergent exploration; spatial tasks need visualization; calculations need algorithmic precision. Chain of Mindset (CoM) enables training-free dynamic mode switching, where the model selects appropriate cognitive approaches per reasoning step rather than committing upfront to one strategy.
A Meta-Agent observes reasoning progress and decides which of four specialized mindsets to engage next: Spatial (visualization), Convergent (focused analysis), Divergent (parallel exploration), Algorithmic (precise calculation). Context Gates prevent information pollution between modes while maintaining efficiency.
Standard approach: apply single reasoning strategy throughout problem. Inefficient for multi-faceted problems.
CoM approach: decompose problem into steps, use Meta-Agent to assign optimal cognitive mode per step. Modes collaborate asynchronously: spatial mode generates diagrams, convergent mode analyzes alternatives, divergent mode explores options, algorithmic mode executes calculations.
Key insight: problem-solving naturally decomposes into stages requiring different cognitive approaches. No training needed—just better prompting structure.
Four Cognitive Modes:
Meta-Agent: Observes current reasoning state, selects appropriate next mode
Context Gates: Filter information flow between modes, prevent context pollution
Step-Level Orchestration: Dynamically revise reasoning plan when intermediate results suggest better paths
Training-Free: All logic implemented via prompting; no model updates
Define mode-specific prompts and context management:
MODE_PROMPTS = {
'spatial': """You are a spatial reasoning mode. Visualize the problem using diagrams,
coordinate systems, or visual representations. Describe spatial relationships, positions, and geometric patterns.
Output: ASCII diagram or detailed spatial description.""",
'convergent': """You are a convergent reasoning mode. Focus on rigorous logical analysis.
Identify constraints, dependencies, and hierarchical relationships. Reason systematically from axioms.
Output: Detailed logical derivation.""",
'divergent': """You are a divergent reasoning mode. Explore multiple solution paths in parallel.
Generate alternative approaches, creative interpretations, and unconventional methods.
Output: List of distinct solution strategies.""",
'algorithmic': """You are an algorithmic reasoning mode. Execute precise calculations,
formal procedures, and symbolic manipulations. Use mathematical notation and step-by-step computation.
Output: Numerical result or formal proof."""
}
def select_cognitive_mode(reasoning_state, meta_agent_prompt=None):
"""
Meta-agent selects appropriate cognitive mode based on reasoning state.
Args:
reasoning_state: Current reasoning progress (text)
meta_agent_prompt: Optional custom selection prompt
Returns:
selected_mode: One of ['spatial', 'convergent', 'divergent', 'algorithmic']
"""
if meta_agent_prompt is None:
meta_agent_prompt = """Given the current reasoning state below, which cognitive mode would be most helpful?
- Spatial: For visualizing patterns, geometric relationships, or spatial structures
- Convergent: For focused logical derivation and constraint satisfaction
- Divergent: For exploring alternative approaches and creative solutions
- Algorithmic: For precise calculations and symbolic manipulation
Current state:
{state}
Which mode? Answer with exactly one word: spatial, convergent, divergent, or algorithmic."""
# Query model to select mode
response = query_model(
meta_agent_prompt.format(state=reasoning_state)
)
# Parse response
modes = ['spatial', 'convergent', 'divergent', 'algorithmic']
for mode in modes:
if mode in response.lower():
return mode
return 'convergent' # Default fallback
class ContextGate:
"""Filters context between cognitive modes."""
def __init__(self):
self.mode_contexts = {}
def filter_for_mode(self, full_context, target_mode):
"""Extract relevant context for specific mode."""
# Simple filtering: remove incompatible information
if target_mode == 'spatial':
# Keep spatial/visual information, remove algorithmic details
filtered = '\n'.join([
line for line in full_context.split('\n')
if not any(x in line.lower() for x in ['formula', 'equation', 'calculate'])
])
elif target_mode == 'algorithmic':
# Keep symbolic information, remove visual descriptions
filtered = '\n'.join([
line for line in full_context.split('\n')
if not any(x in line.lower() for x in ['visualize', 'diagram', 'imagine'])
])
else:
filtered = full_context
return filtered
class AdaptiveMindsetReasoner:
"""Chain of Mindset reasoning orchestrator."""
def __init__(self, base_model, max_iterations=10):
self.model = base_model
self.max_iterations = max_iterations
self.context_gate = ContextGate()
self.full_reasoning = ""
self.mode_history = []
def reason_adaptively(self, problem):
"""Execute adaptive reasoning with dynamic mode selection."""
reasoning = f"Problem: {problem}\n\n"
for iteration in range(self.max_iterations):
# Meta-agent selects next mode
selected_mode = select_cognitive_mode(reasoning)
self.mode_history.append(selected_mode)
# Filter context for this mode
filtered_context = self.context_gate.filter_for_mode(reasoning, selected_mode)
# Generate reasoning step in selected mode
mode_prompt = MODE_PROMPTS[selected_mode]
full_prompt = f"{mode_prompt}\n\nCurrent reasoning:\n{filtered_context}\n\nNext step:"
mode_output = self.model.generate(full_prompt, max_tokens=200)
reasoning += f"\n[{selected_mode.upper()}]: {mode_output}"
# Check for completion
if any(x in mode_output.lower() for x in ['answer:', 'solution:', 'therefore:']):
break
self.full_reasoning = reasoning
return reasoning
def extract_final_answer(self):
"""Extract final answer from reasoning trace."""
import re
# Look for explicit answer statements
patterns = [
r'answer:\s*(.+?)(?:\n|$)',
r'solution:\s*(.+?)(?:\n|$)',
r'therefore,\s*(.+?)(?:\n|$)',
r'result:\s*(.+?)(?:\n|$)'
]
for pattern in patterns:
match = re.search(pattern, self.full_reasoning, re.IGNORECASE)
if match:
return match.group(1).strip()
# Fallback: return last non-empty line
lines = [l.strip() for l in self.full_reasoning.split('\n') if l.strip()]
return lines[-1] if lines else ""
Usage example:
# Initialize reasoner
model = load_language_model("gpt-4")
reasoner = AdaptiveMindsetReasoner(model)
# Complex problem requiring multiple cognitive modes
problem = """A farmer has a rectangular field divided into 4 equal quadrants.
He wants to plant crops such that adjacent quadrants have different crop types.
He has 3 crop types. How many distinct planting patterns exist if rotations and
reflections are considered the same?"""
# Adaptive reasoning with dynamic mode selection
reasoning_trace = reasoner.reason_adaptively(problem)
print(reasoning_trace)
print("\nMode sequence:", reasoner.mode_history)
final_answer = reasoner.extract_final_answer()
print("\nFinal Answer:", final_answer)
| Parameter | Recommendation | Notes | |-----------|-----------------|-------| | Max iterations | 8-15 | More iterations explore thoroughly; cap to avoid repetition. | | Mode diversity | Encourage all 4 modes | Don't let meta-agent favor one mode; track usage. | | Context filtering strictness | Moderate | Balance focus with information retention. | | Integration point | After problem statement | Let model choose modes rather than prescribing strategy. |
When to Use
When NOT to Use
Common Pitfalls
See https://arxiv.org/abs/2602.10063 for full prompt templates, detailed mode descriptions, meta-agent implementation, and benchmarks across mathematics (AIME, MATH), coding (HumanEval), and spatial reasoning (Rotate3D).
testing
Uses flow maps as look-ahead operators to enable principled reward-guided diffusion by predicting trajectory endpoints at any denoising step. Deploy when applying rewards or preferences to diffusion trajectories with meaningful gradients throughout generation.
testing
Train language models where each expert learns independently on closed datasets, enabling flexible inference with selective data inclusion or exclusion. 41% performance improvement while allowing users to opt out of specific data sources without retraining.
data-ai
Understand how token generation flexibility in diffusion LMs paradoxically constrains reasoning, as models exploit ordering flexibility to avoid uncertain tokens, and apply simplified approaches that preserve parallel decoding benefits. Use when optimizing diffusion-based language models for reasoning tasks.
devops
Enable LLM agents to improve continuously during deployment by constructing structured experience libraries through self-reflection on successes and failures—achieving 23% improvement on reasoning without gradient-based parameter updates or external training.