An Autonomous Mathematical Research Agent for the Riemann Hypothesis — now powered by DeepSeek (deepseek-chat / deepseek-reasoner) —
Build, attempt, and archive mathematical hypotheses related to the Riemann Hypothesis — autonomously, around the clock, the moment it is launched. When — and only when — a verifier-accepted proof of RH is produced, halt everything and alert the human owner.
- Overview
- Key Principles
- The Six Mathematical Tasks
- Architecture
- The Artificial Junky Neuron (AJN)
- The 14-Layer ANN-Psi Backbone
- Multi-LLM Integration (v2.0 — DeepSeek-primary edition)
- ArXiv Integration
- Document Generation & Hierarchical Archive
- The Riemann Alert
- Owner Guidance
- Installation
- Quick Start
- Usage
- Configuration
- Project Structure
- Lineage & Credits
- License
zeta-riemannian-agent (alias :zRiemannian) is an autonomous AI research agent that, upon launch, immediately begins producing mathematical documents — hypotheses, proof attempts, theorems, and periodic attempts at the Riemann Hypothesis itself. It does not wait for an owner directive; this is the core property of the Artificial Junky Neuron (AJN) framework on which it is built.
The agent was created by dramatically re-targeting and extending
quantum-spherifier
(which targeted quantum computing research), which in turn extended
fusionary-agent
(nuclear fusion). Both inherit from the original
predator-jungle-agent v2.0 by Justo Tapiador Garcia (Universidad de
Alicante), which defines the AJN architecture.
| Aspect | v1.x | v2.0 |
|---|---|---|
| Primary LLM | Z.ai GLM-4.6 (or Groq Llama 3.3 70B) | DeepSeek (deepseek-chat + deepseek-reasoner) |
| Task routing | Single model for all tasks | Two specialised models (V3 for speed, R1 for proofs) |
| Cycle stats tracking | Limited (cumulative only) | Per-cycle: calls, tokens in/out, provider, model |
| AgentCycle schema | llmCalls, tokensUsed |
+ llmTokensIn, llmTokensOut, llmProvider, llmModel |
| Failover chain | ZAI → stub | DeepSeek → ZAI → stub |
| README | ZAI-primary | DeepSeek-primary with badge |
| Feature | quantum-spherifier | zeta-riemannian-agent v2.0 |
|---|---|---|
| Domain | Quantum computing | Pure mathematics — Riemann Hypothesis |
| Primary LLM | GLM-4.6 | DeepSeek (deepseek-chat / deepseek-reasoner) |
| Research target | Multi-line (4 lines, cross-linked) | Single conjecture (RH) with satellite hypotheses |
| Document format | LaTeX + patent drafts | LaTeX only + compiled PDF |
| Central probe | Patent-cluster readiness | Periodic full RH proof attempts |
| Alert mode | Patent filing ready | RIEMANN-PROVEN MODE — halts all research |
| Cycle stats | Basic | Per-cycle LLM calls, tokens in/out, provider, model |
| Web dashboard | 8 tabs | 9 tabs with live Cycle History showing LLM usage |
-
Autonomous activation (AJN addiction) — On launch, zRiemannian immediately starts researching. It does not wait for a request.
-
A single central conjecture — The Riemann Hypothesis is the gravitational centre of the agent's research.
-
Periodic central probes — Every 5th cycle is a Riemann attempt using
deepseek-reasoner(R1) — the strongest model for mathematical reasoning in the DeepSeek family. -
The archive is the long-term memory — Successfully proven hypotheses are promoted to theorems, tagged, indexed, and stored in
research/theorems/. -
ArXiv as ground truth — The agent periodically scans ArXiv for preprints related to RH, caches them locally, summarises them with
deepseek-chat(V3), and uses them as inspiration and citation. -
The alert is sacred — When a Riemann attempt passes the verifier with confidence ≥ 0.90, the agent enters RIEMANN-PROVEN MODE.
-
Task-routed multi-LLM —
deepseek-chat(V3) for fast creative tasks (hypotheses, summaries),deepseek-reasoner(R1) for deep reasoning (proofs, Riemann). Z.ai GLM-4.6 as optional fallback.
-
Creation of hypotheses related to the central conjecture. Each cycle, the agent uses
deepseek-chatto propose a new, well-formed mathematical hypothesis connected to RH. -
Access to mathematical preprint libraries. The agent queries the ArXiv API for RH-related preprints, caches them, and summarises each with
deepseek-chat. -
Attempted proof of the proposed hypothesis. Each cycle, the agent picks an open hypothesis and uses
deepseek-reasoner(R1) to produce a LaTeX proof attempt. The proof is compiled to PDF viatectonic. -
Promotion of proven hypotheses to theorems. A second LLM pass (also
deepseek-reasoner) inspects each proof. If the verdict isvalidwith confidence ≥ 0.75, the hypothesis is promoted to a theorem: tagged, indexed, and stored underresearch/theorems/. -
Periodic attempts at the central conjecture. Every 5th cycle is a Riemann attempt using
deepseek-reasoner(R1) with one of ten predefined proof strategies. -
The Riemann alert. When — and only when — a Riemann attempt passes the adversarial verifier with confidence ≥ 0.90, the agent enters RIEMANN-PROVEN MODE: halts all hypothesis creation, sets the global
riemannProvenflag, writes the LaTeX + PDF, displays a pulsing red banner on the dashboard, and re-broadcasts the alert every 15 seconds until the owner acknowledges.
zRiemannian is a 14-layer ANN-Psi backbone (AJN + Transformer) wrapped in a research-cycle orchestrator, backed by a multi-LLM router (DeepSeek primary, Z.ai fallback), a mathematical knowledge graph, an ArXiv adapter, and a hierarchical document archive.
┌─────────────────────────────────────────────────────────────────┐
│ Owner Guidance Layer │
│ Web Dashboard (native Node.js + vanilla JS) · WebSocket │
└───────────────────────┬─────────────────────────────────────────┘
│
┌───────────────────────▼─────────────────────────────────────────┐
│ ZRiemannianAgent (orchestrator) │
│ cycle loop · phase picker · owner-directive queue · snapshot │
│ cycleStats() / resetCycleStats() — per-cycle LLM tracking │
└───────────────────────┬─────────────────────────────────────────┘
│
┌───────────────────────▼─────────────────────────────────────────┐
│ ANN-Psi Backbone (14 layers) │
│ L1-L2 Hybrid AJN · L3 Hetero AJN K=8 · L4-L5 Transformer │
│ L6 Hetero AJN K=16 · L7 Hybrid AJN · L8-L9 Transformer │
│ L10 Hetero AJN K=32 · L11 Hybrid AJN · L12 Hetero AJN K=8 │
│ L13 Hybrid AJN · L14 Output AJN │
└───────────────────────┬─────────────────────────────────────────┘
│
┌───────────────────────▼─────────────────────────────────────────┐
│ LLM Router (DeepSeek-primary, v2.0) │
│ DeepSeek (deepseek-chat + deepseek-reasoner) ← PRIMARY │
│ Z.ai GLM-4.6 ← fallback │
│ Deterministic stub ← last resort │
└───────────────────────┬─────────────────────────────────────────┘
│
┌──────────────┼──────────────┬─────────────┐
▼ ▼ ▼ ▼
┌──────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐
│ Hypothesis │ │ Proof │ │ Theorem │ │ Riemann │
│ Generator │ │ Attempter │ │ Archivist │ │ Prober │
│ (deepseek- │ │ (deepseek- │ │ │ │ (deepseek- │
│ chat) │ │ reasoner) │ │ │ │ reasoner) │
└──────┬───────┘ └──────┬─────┘ └──────┬─────┘ └──────┬─────┘
│ │ │ │
└────────┬───────┴───────┬──────┴──────────────┘
▼ ▼
┌──────────────┐ ┌──────────────┐
│ ArXiv │ │ Knowledge │
│ Adapter │ │ Graph │
└──────┬───────┘ └──────────────┘
│
▼
┌──────────────┐
│ Document │
│ Archivist │ ──► research/hypotheses/ (H-YYYY-NNNN.tex)
│ + tectonic │ ──► research/proofs/ (PA-YYYY-NNNN.tex + .pdf)
│ │ ──► research/theorems/ (T-YYYY-NNNN.tex + .pdf)
│ │ ──► research/arxiv-cache/ (abstracts + summaries)
│ │ ──► research/riemann-attempts/ (RH-YYYY-NNNN.tex + .pdf)
└──────────────┘
The Artificial Junky Neuron (AJN) is the defining architectural
primitive inherited from predator-jungle-agent. An AJN neuron is
"addicted" to its task domain: it fires autonomously when the agent is
launched and does NOT wait for an external request.
In zRiemannian, this means: the moment you run bun web/server.js, the
orchestrator's start() method is called, which immediately schedules
the first cycle with zero delay. There is no "warm-up" — the agent
begins producing mathematical hypotheses within seconds of launch.
| Layer | Name | Kind | Role |
|---|---|---|---|
| L1 | Sensory-A | AJN-Hybrid | ArXiv abstract intake |
| L2 | Sensory-B | AJN-Hybrid | Knowledge-graph delta intake |
| L3 | Pattern-8 | AJN-Hetero K=8 | Multi-head pattern detection across cache |
| L4 | Attn-Lo-1 | Transformer | Long-range self-attention over hypotheses |
| L5 | Attn-Lo-2 | Transformer | Hypothesis cluster formation |
| L6 | XL-16 | AJN-Hetero K=16 | Cross-link synthesis: theorems ↔ hypotheses |
| L7 | Strategy | AJN-Hybrid | Proof-strategy selection |
| L8 | Sketch-1 | Transformer | Proof-sketch generation |
| L9 | Sketch-2 | Transformer | Proof-sketch refinement |
| L10 | Verify-32 | AJN-Hetero K=32 | Deep verification routing |
| L11 | Verdict | AJN-Hybrid | Verdict aggregation |
| L12 | Archive | AJN-Hetero K=8 | Archival decision |
| L13 | RH-Trigger | AJN-Hybrid | Riemann-prober trigger evaluation |
| L14 | Emit | Output-AJN | Final emission: doc / event / alert |
Starting with v2.0, zRiemannian uses DeepSeek as the primary LLM,
with Z.ai GLM-4.6 as an optional fallback. This change reflects the
superior mathematical reasoning capability of deepseek-reasoner (R1)
over general-purpose chat models, especially for proof sketching and
verification.
Each cognitive task is dispatched to the most appropriate DeepSeek model:
| Task | Model | Purpose |
|---|---|---|
hypothesis-gen |
deepseek-chat (V3) |
Creative, broad — propose new hypotheses |
proof-sketch |
deepseek-reasoner (R1) |
Long-form reasoning — produce LaTeX proof body |
proof-verify |
deepseek-reasoner (R1) |
Adversarial self-check — verdict on proof attempts |
arxiv-summarise |
deepseek-chat (V3) |
Fast compression — summarise ArXiv abstracts |
riemann-attempt |
deepseek-reasoner (R1) |
Frontier reasoning — full RH proof attempt |
riemann-verify |
deepseek-reasoner (R1) |
Double-adversarial — highest-stakes verdict |
kg-synthesise |
deepseek-chat (V3) |
Concept-graph maintenance |
freeform |
deepseek-chat (V3) |
General purpose |
Why two models?
deepseek-chat(V3) is fast and cheap — good enough for creative hypothesis generation and ArXiv abstract summarisation, where speed matters more than depth.deepseek-reasoner(R1) is slower and more expensive but significantly better at mathematical reasoning — used for proofs and the Riemann attempts where correctness is paramount.
- DeepSeek (primary) — if
DEEPSEEK_API_KEYis set - Z.ai GLM-4.6 (fallback) — if
ZAI_API_KEYor.z-ai-configis set - Deterministic stub (last resort) — clearly tagged in the UI
If DeepSeek errors or times out (90s), the router falls back to ZAI automatically. If neither is available, the router falls back to a deterministic stub so the agent can still produce something — clearly tagged in the UI so the owner knows creative generation is degraded.
Set these environment variables in .env (see .env.example):
# DeepSeek (PRIMARY — recommended, generous free credit for new users)
# Sign up at https://platform.deepseek.com
DEEPSEEK_API_KEY=sk-...
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1
# Z.ai GLM-4.6 (optional fallback)
# ZAI_API_KEY=...
# ZAI_BASE_URL=https://api.z.ai/api/paas/v4
- Mathematical reasoning:
deepseek-reasoner(R1) is one of the best open-weight reasoning models currently available, comparable to OpenAI's o1 on math benchmarks at a fraction of the cost. - Cost: DeepSeek pricing is ~10× cheaper than OpenAI/Anthropic for equivalent reasoning quality. New users get a generous free credit.
- OpenAI-compatible API: DeepSeek's API is a drop-in replacement for
OpenAI's
/v1/chat/completionsendpoint, so integrating it was straightforward. - Two specialised models: V3 for speed, R1 for depth — we route each task to the most appropriate one.
The LLMRouter now exposes two methods for per-cycle tracking:
cycleStats()— returns{ calls, tokensIn, tokensOut, provider, model }at the end of each cycleresetCycleStats()— zeroes the counters at the start of the next cycle
The orchestrator calls these to populate the new AgentCycle fields:
model AgentCycle {
// ... existing fields ...
llmCalls Int @default(0)
llmTokensIn Int @default(0)
llmTokensOut Int @default(0)
llmProvider String @default("none")
llmModel String @default("none")
// ...
}The Cycle History UI tab now displays these per-cycle stats live:
# | Phase | Status | Provider | Model | LLM calls | Tokens (in/out)
--+---------------+--------+----------+--------------------+-----------+----------------
35| proof-attempt | ok | deepseek | deepseek-reasoner | 2 | 1738 / 3270
34| arxiv-scan | ok | deepseek | deepseek-chat | 5 | 1161 / 529
The arxiv-adapter.ts module queries the public ArXiv API
(http://export.arxiv.org/api/query) using a rotating set of RH-related
search terms:
- "Riemann hypothesis"
- "Riemann zeta function zeros"
- "critical line"
- "critical strip"
- "functional equation zeta"
- "xi function"
- "explicit formula"
- "Dirichlet L-function zeros"
- "prime number theorem"
- "Selberg class"
- "random matrix zeta"
- "Hilbert–Pólya"
- "Weil explicit formula"
- "converse theorem L-function"
Each fetched preprint is given a relevance score and summarised by
deepseek-chat (V3) in 2–3 sentences emphasising RH relevance.
All mathematical artefacts are produced as LaTeX and compiled to PDF via
tectonic. The local archive lives under research/:
research/
├── INDEX.md # auto-regenerated top-level index
├── hypotheses/
│ ├── H-2026-0001.tex
│ └── H-2026-0001.meta.json
├── proofs/
│ ├── PA-2026-0001.tex
│ ├── PA-2026-0001.pdf
│ ├── PA-2026-0001.verifier.json
│ └── ...
├── theorems/
│ ├── T-2026-0001.tex
│ ├── T-2026-0001.pdf
│ └── T-2026-0001.tags.json
├── arxiv-cache/
│ └── <arxivId>.summary.md
├── riemann-attempts/
│ ├── RH-2026-0001.tex
│ ├── RH-2026-0001.pdf
│ └── RH-2026-0001.verifier.json
└── cross_refs.json
When a Riemann attempt is judged valid by the adversarial verifier
(deepseek-reasoner R1) with confidence ≥ 0.90 (RH_PROMOTION_THRESHOLD),
the agent enters RIEMANN-PROVEN MODE:
- The global
AgentState.riemannProvenflag is set totrue. AgentState.isHaltedis set totrue— the autonomous cycle loop pauses.- A
riemann-provenevent withlevel: 'critical'is broadcast on the WebSocket. - The web dashboard displays a pulsing red banner at the top of every page.
- The agent re-broadcasts the alert every 15 seconds until the owner acknowledges or shuts it down.
- The LaTeX source and compiled PDF are sealed under
research/riemann-attempts/<shortCode>.texand.pdf.
The threshold of 0.90 is intentionally very high. The verifier prompt
instructs the LLM to be maximally skeptical: "Only return valid if the
proof would survive peer review at Annals of Mathematics."
Although zRiemannian is autonomous by design (AJN addiction), the human owner can guide it through the Guidance tab of the web dashboard. Directives are queued and applied at the start of the next cycle.
| Directive | Effect |
|---|---|
set-focus |
Bias hypothesis generation toward a specific topic |
halt |
Pause the autonomous cycle loop |
resume |
Unpause the cycle loop |
force-riemann-attempt |
Trigger a Riemann attempt immediately |
inject-hypothesis |
Inject a specific hypothesis bypassing LLM |
rerun-cycle |
Force the next cycle to run immediately |
shutdown |
Stop the orchestrator entirely |
- Node.js ≥ 18 (or Bun ≥ 1.0 — recommended)
- tectonic (LaTeX engine) — optional but recommended for PDF compilation
# Clone the repository
git clone https://github.com/Justo-Tapiador/zeta-riemannian-agent.git
cd zeta-riemannian-agent
# Install dependencies
bun install # or: npm install
# Set up environment variables
cp .env.example .env
# edit .env to add DEEPSEEK_API_KEY (and optionally ZAI_API_KEY)
# Generate Prisma client and create the database
bun run db:generate
bun run db:push
# Verify tectonic is available (optional)
which tectonic# Single command — starts the native Node.js web server AND the agent
bun run webOpen http://localhost:3000 in your browser. You should see the zRiemannian dashboard with the Overview tab active. Within seconds, the ● live badge should appear, the cycle # counter should increment, and the Activity tab should start filling with events.
The web dashboard is served by a single-file native Node.js HTTP server
at web/server.js — plain HTML + vanilla JS + CSS, no build step.
web/public/zr-1.png(resized tozr-1-small.pngat 200px) appears in the top-left header next to the title.web/public/zr-2.png(resized tozr-2-small.pngat 180px) appears centered at the bottom of the page, just above the footer.
By default, zRiemannian runs autonomously. Just launch the runtime and let it work.
The dashboard is built with native Node.js + vanilla JavaScript. It connects to the agent via WebSocket (Socket.io) and receives real-time updates. The dark theme is inspired by terminal editors and Bloomberg-style financial dashboards.
See Owner Guidance above.
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
file:./db/custom.db |
SQLite database URL |
DEEPSEEK_API_KEY |
(required) | DeepSeek API key (primary LLM) |
DEEPSEEK_BASE_URL |
https://api.deepseek.com/v1 |
DeepSeek API base URL |
ZAI_API_KEY |
(optional) | Z.ai GLM-4.6 API key (fallback) |
ZAI_BASE_URL |
https://api.z.ai/api/paas/v4 |
Z.ai API base URL |
| Constant | File | Default | Description |
|---|---|---|---|
CYCLE_INTERVAL_MS |
orchestrator.ts |
60_000 | Delay between cycles |
RIEMANN_EVERY_N_CYCLES |
orchestrator.ts |
5 | Run a Riemann attempt every N cycles |
ARXIV_EVERY_N_CYCLES |
orchestrator.ts |
3 | Scan ArXiv every N cycles |
ARCHIVE_EVERY_N_CYCLES |
orchestrator.ts |
7 | Regenerate INDEX.md every N cycles |
PROMOTION_THRESHOLD |
proof-verifier.ts |
0.75 | Confidence to promote hypothesis to theorem |
RH_PROMOTION_THRESHOLD |
riemann-prober.ts |
0.90 | Confidence to declare RH proven |
zeta-riemannian-agent/
├── README.md # this file
├── LICENSE # MIT
├── .env.example # template for environment variables
├── package.json # dependencies + scripts
├── prisma/
│ └── schema.prisma # Hypothesis, ProofAttempt, Theorem, RiemannAttempt, ArxivPaper, KGNode, KGEdge, AgentCycle, OwnerDirective, AgentState
├── src/
│ ├── lib/
│ │ ├── db.ts # Prisma client
│ │ └── agent/
│ │ ├── types.ts # shared TypeScript types
│ │ ├── logger.ts # structured logger with ring buffer
│ │ ├── ajn-backbone.ts # 14-layer ANN-Psi backbone spec
│ │ ├── llm-router.ts # DeepSeek-primary multi-LLM router (v2.0)
│ │ ├── arxiv-adapter.ts # ArXiv API + caching
│ │ ├── latex-compiler.ts # tectonic wrapper
│ │ ├── document-archivist.ts # hierarchical LaTeX storage + templates
│ │ ├── knowledge-graph.ts # KG nodes + edges + seeding
│ │ ├── hypothesis-generator.ts # uses deepseek-chat
│ │ ├── proof-attempter.ts # uses deepseek-reasoner
│ │ ├── proof-verifier.ts # uses deepseek-reasoner
│ │ ├── theorem-archivist.ts
│ │ ├── riemann-prober.ts # uses deepseek-reasoner (RH prober + alert)
│ │ ├── json-utils.ts # robust JSON extractor for LaTeX-in-JSON
│ │ └── orchestrator.ts # main autonomous loop with cycleStats()
│ └── components/ # (legacy, not used by native server)
├── web/
│ ├── server.js # native Node.js HTTP + Socket.io server
│ └── public/
│ ├── index.html # 9-tab dashboard
│ ├── css/style.css # dark theme
│ ├── js/app.js # vanilla JS
│ ├── zr-1-small.png # header logo
│ └── zr-2-small.png # footer logo
├── scripts/
│ ├── supervise-agent.sh # supervisor for the agent runtime
│ └── supervise-web.sh # supervisor for the web server
├── research/ # local document archive (hierarchical)
│ ├── hypotheses/
│ ├── proofs/
│ ├── theorems/
│ ├── arxiv-cache/
│ └── riemann-attempts/
├── docs/
│ └── architecture.md # detailed architecture document
└── db/
└── custom.db # SQLite database
zRiemannian is the latest in a lineage of autonomous research agents built on the Artificial Junky Neuron (AJN) framework by Justo Tapiador Garcia (Universidad de Alicante):
predator-jungle-agent v2.0 (the original AJN framework)
│
▼
fusionary-agent (nuclear fusion research)
│
▼
quantum-spherifier (quantum computing research)
│
▼
zeta-riemannian-agent v2.0 (this project — Riemann Hypothesis research)
↑
DeepSeek-primary edition
- predator-jungle-agent v2.0: https://github.com/Justo-Tapiador/predator-jungle-agent
- fusionary-agent: https://github.com/Justo-Tapiador/fusionary-agent
- quantum-spherifier: https://github.com/Justo-Tapiador/quantum-spherifier
MIT © 2026 — zeta-riemannian-agent project. Based on the Agentic Theory by Justo Tapiador Garcia (Universidad de Alicante).
