learnlance 🧠🔍
A learning companion for Claude Code, OpenAI Codex, and other coding agents. Every time an agent finishes a turn and has generated or edited code, learnlance quietly:
- reads the session transcript and pulls out the code that was just written,
- asks Claude "what concepts could a developer learn from this?" — e.g. "you used a delta function, here's what delta encoding is",
- merges those concepts into a persistent knowledge graph, and
- regenerates an interactive HTML graph you can open any time.
No API key required. By default it reuses the claude CLI you're already
logged into (your Claude Code subscription), so there's nothing extra to set up.
So instead of code just appearing, you build up a visual map of everything you've picked up along the way — new nodes light up as 🌱 new topics learned.
Why it won't slow you down or break your session
- The API call runs in a detached background process — Claude Code never waits.
- The hook is wrapped so any failure is logged and swallowed; it can never interrupt your coding session.
- Turns with no substantive code make no API call (no cost, no noise).
Install (no pip, no API key)
# just install the Claude Code Stop hook — it uses your logged-in `claude`
python -m learnlance install
Run this from the learnlance/ project folder. That's it — start (or restart)
Claude Code and code as usual.
If claude isn't on your PATH, point learnlance at it:
python -m learnlance config --claude-bin "C:\path\to\claude.cmd"
Prefer a global
learnlancecommand?pip install -e .in this folder, then uselearnlanceinstead ofpython -m learnlanceeverywhere.Prefer a direct API call instead of the CLI?
learnlance config --backend api --set-key sk-ant-...
Use it
learnlance show # render + open the interactive knowledge graph in your browser
learnlance list -v # list learned concepts (with explanations) in the terminal
learnlance stats # quick counts, broken down by category
learnlance help # show every available command
The show view opens with a live loading spinner while it renders, then two
declutter controls in the sidebar: show related concepts (reveal the dimmed
umbrella nodes) and a min link strength slider (hide one-off links).
OpenAI Codex
Install the project-local Codex hooks with:
python -m learnlance install --codex
Codex's native apply_patch edits are captured through PostToolUse and
analyzed at Stop. After installing, review/trust the hook in Codex with
/hooks. Use --in-chat if you want Codex to analyze its own work.
When you run any learnlance command in a project, it automatically detects
active agent environments and installs missing project hooks. This also works
when you move to a new project after the first setup; no separate setup command
is required.
Add a concept Claude missed
learnlance add "debouncing" # searches the current dir for the topic
learnlance add "topological sort" --path ./src
learnlance add "event sourcing" --force # add even if it's not found in the code
learnlance greps your codebase for the topic, sends the matching snippets to Claude, and adds the concept (and any tightly-related ones actually present) just like the hook does.
Clear the graph
learnlance clear "delta encoding" # remove one concept (and any orphaned related nodes)
learnlance clear # wipe the entire graph (asks first; -y to skip)
Per-session markdown recaps are written to ~/.learnlance/insights/<session>.md.
Configuration
learnlance config # show current settings
learnlance config --cli-model haiku # make the cli backend use a faster model
learnlance config --max-topics 3 # fewer concepts per turn
learnlance config --background off # run inline (blocks until analysis is done)
learnlance config --disable # pause without uninstalling the hook
learnlance config --backend api --set-key sk-ant-... # switch to the API backend
Everything lives under ~/.learnlance/:
graph.json (the graph), graph.html (the visualization), insights/
(markdown recaps), learnlance.log (diagnostics).
Uninstall
python -m learnlance uninstall
How it works (internals)
| File | Role |
|---|---|
hook.py |
Stop-hook entry; spawns the detached worker |
transcript.py |
Parses Claude Code's JSONL transcript for generated code |
insights.py |
Generates insights — via the claude CLI (default) or the API |
codesearch.py |
Finds where a topic lives in your code (powers add) |
graph.py |
Merges concepts into the persistent knowledge graph |
viz.py |
Renders the offline, self-contained HTML graph |
spinner.py |
The animated terminal loading indicator |
install.py |
Wires the hook into ~/.claude/settings.json |
adapters.py |
Translates each agent's hook payload, including Codex patches |
Zero third-party dependencies by design — the hook must run reliably wherever Claude Code launches it.
Metadata
Release files for learnlance-univ 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| learnlance_univ-0.2.7.tar.gz | 77.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| learnlance_univ-0.2.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 144.9 kB
Release files / learnlance_univ-0.2.7.tar.gz
| Download URL | learnlance_univ-0.2.7.tar.gz |
|---|---|
| Size | 77.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08643a5522ea7405bcda02c9f53e0e36ec3d65a282297d832d3afff28be41120
|
|
BLAKE2b-256 checksum How to use checksums |
b9b9ee734252fdebb1f20a618a5abd77629a1130433437e1906c3c32535f7dda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logRelease files / learnlance_univ-0.2.7-py3-none-any.whl
| Download URL | learnlance_univ-0.2.7-py3-none-any.whl |
|---|---|
| Size | 67.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc7061d797f9e94998ba3ba8d64a24a000b1afe7568aafa45c1024f10f442266
|
|
BLAKE2b-256 checksum How to use checksums |
9b064c98ad1bf67f88c4d9392d1a8b694321a5590c1afef414a452797c50a028
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency log