Companion code for the book Build a Large Language Model (From Scratch), implementing a GPT-like LLM in PyTorch step by step.
AbdullahAlhariri/penmentor
An AI math mentor that marks up your handwritten work on screen with hints, not answers, and can animate ideas with manim.
- Stars
- 68
- Forks
- 3
- Open issues
- 0
- Last commit
- 17 hours ago
What is it?
penmentor is a desktop helper for studying maths by hand. While you write on a pen tablet, pressing a key sends the current page to an AI model, which marks the work on screen the way a teacher would with coloured pens: circling the first real mistake, ticking correct lines, and underlining later steps that depend on it. Hints follow a ladder from a light nudge to naming the technique, and it can also ask recall questions or pose find-the-error drills.
Boxing part of a page produces an interactive animation built with 3Blue1Brown's manim library, such as dragging integration bounds or watching Riemann sums converge. The tool is built for xournal++ on Linux under X11, with a small plugin so the model sees the whole page rather than only the visible area.
It runs on existing AI command-line agents rather than a separate API key: Claude Code, Codex, and Antigravity CLI, selected by model prefix in Settings. Setup requires one of those agents logged in, plus rofi, slop, xdotool and PyQt6.
Key features
- 01Marks handwritten work on screen: circles the first mistake and ticks correct lines.
- 02Gives graded hints rather than full answers.
- 03Generates interactive manim animations from a boxed region of the page.
- 04Works with Claude Code, Codex and Antigravity CLI through model prefixes.
- 05Includes an xournal++ plugin so the model sees the whole page.
- 06Offers recall questions and find-the-error practice.
Use cases
- Studying calculus or other maths by hand on a pen tablet in xournal++.
- Getting feedback on homework steps without copying work into a chat window.
- Visualising a concept, such as an integral or limit, as an interactive animation.
Quick start
- 1
Clone the repository
git clone https://github.com/AbdullahAlhariri/penmentor ~/src/penmentor - 2
Run the self-test
~/src/penmentor/bin/penmentor --selftest - 3
Bind bin/penmentor to a key in your window manager (see the i3 example and the guide)
Things to know
- Linux on X11 only, best with i3.
- Requires an installed and logged-in agent CLI (claude, codex or agy) plus rofi, slop, xdotool and PyQt6.
- Works through the xournal++ workflow described in the README.
Topics
FAQ
- What is penmentor?
- An AI math mentor that marks up your handwritten work on screen with hints, not answers, and can animate ideas with manim. penmentor is a desktop helper for studying maths by hand. While you write on a pen tablet, pressing a key sends the current page to an AI model, which marks the work on screen the way a teacher would with coloured pens: circling the first real mistake, ticking correct lines, and underlining later steps that depend on it. Hints follow a ladder from a light nudge to naming the technique, and it can also ask recall questions or pose find-the-error drills.
- Is penmentor free to use? What license does it have?
- penmentor is open source under the MIT license. Check the license terms before using it in commercial products.
- Is penmentor still maintained?
- Actively maintained. The last commit to penmentor was on Oct 20, 2026.
- What can I use penmentor for?
- Studying calculus or other maths by hand on a pen tablet in xournal++. Getting feedback on homework steps without copying work into a chat window. Visualising a concept, such as an integral or limit, as an interactive animation.
- How do I install penmentor?
- Clone the repository: git clone https://github.com/AbdullahAlhariri/penmentor ~/src/penmentor Run the self-test: ~/src/penmentor/bin/penmentor --selftest Bind bin/penmentor to a key in your window manager (see the i3 example and the guide)
- Where can I get penmentor?
- The source code and installation instructions are on GitHub: https://github.com/AbdullahAlhariri/penmentor
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An agentic framework that generates educational videos by writing executable Manim code instead of producing pixels directly.
An API for AI agents to search, scrape, and interact with web pages, returning clean markdown, JSON, and screenshots.
Agent-native memory infrastructure that turns LLM agent conversations and execution into persistent, structured memory for Python and TypeScript apps.
A local vector index and RAG toolkit that cuts storage by about 97% by recomputing embeddings on demand, so you can search personal data on your laptop.
Enterprise-grade agentic workflow platform for building and running AI agents, with model management, MCP tool integration and RPA automation.