MCPcopy Index your code
hub / github.com/PhialsBasement/Chain-of-Recursive-Thoughts

github.com/PhialsBasement/Chain-of-Recursive-Thoughts @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
64 symbols 151 edges 12 files 13 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CoRT (Chain of Recursive Thoughts) 🧠🔄

TL;DR: I made my AI think harder by making it argue with itself repeatedly. It works stupidly well.

What is this?

CoRT makes AI models recursively think about their responses, generate alternatives, and pick the best one. It's like giving the AI the ability to doubt itself and try again... and again... and again.

Does it actually work?

YES. I tested it with Mistral 3.1 24B and it went from "meh" to "holy crap", especially for such a small model, at programming tasks.

How it works

  1. AI generates initial response
  2. AI decides how many "thinking rounds" it needs
  3. For each round:
  4. Generates 3 alternative responses
  5. Evaluates all responses
  6. Picks the best one
  7. Final response is the survivor of this AI battle royale

How to use the Web UI(still early dev)

  1. Open start_recthink.bat
  2. wait for a bit as it installs dependencies
  3. profit??

If running on linux:

pip install -r requirements.txt
cd frontend && npm install
cd ..
python ./recthink_web.py

(open a new shell)

cd frontend
npm start

Examples

Mistral 3.1 24B + CoRT rec

Mistral 3.1 24B non CoRT non-rec

Try it yourself

pip install -r requirements.txt
export OPENROUTER_API_KEY="your-key-here"
python recursive-thinking-ai.py

The Secret Sauce

The magic is in:

  • Self-evaluation
  • Competitive alternative generation
  • Iterative refinement
  • Dynamic thinking depth

Star History(THANK YOU SO MUCH)

Star History Chart

Contributing

Found a way to make it even better? PR's welcome!

License

MIT - Go wild with it

Core symbols most depended-on inside this repo

_call_api
called by 4
recursive_thinking_ai.py
disable_all_buttons
called by 4
demos/rec-tic-tac.py
think_and_respond
called by 3
recursive_thinking_ai.py
save_full_log
called by 3
recursive_thinking_ai.py
save_conversation
called by 3
recursive_thinking_ai.py
handleSaveConversation
called by 3
frontend/src/components/RecursiveThinkingInterface.jsx
print_board
called by 3
demos/tic-tac.py
initializeChat
called by 2
frontend/src/context/RecThinkContext.js

Shape

Function 46
Method 8
Route 6
Class 4

Languages

Python66%
TypeScript34%

Modules by API surface

recthink_web.py19 symbols
recursive_thinking_ai.py10 symbols
demos/rec-tic-tac.py9 symbols
frontend/src/context/RecThinkContext.js7 symbols
frontend/src/components/RecursiveThinkingInterface.jsx7 symbols
frontend/src/api.js6 symbols
demos/tic-tac.py4 symbols
frontend/src/reportWebVitals.js1 symbols
frontend/src/App.js1 symbols

For agents

$ claude mcp add Chain-of-Recursive-Thoughts \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact