prolog-reasoner

A Prolog reasoning agent that turns plain-language statements and questions into Prolog code, then runs queries against knowledge bases. Prolog is a programming language built around facts and rules.

In plain words
What is it for?
Use it to convert documents into Prolog, load or edit knowledge bases, run queries, debug Prolog code, and explain how an inference was reached.
Why use it?
It helps when you need deductive answers from facts and rules without writing every Prolog statement by hand. It can also use solver feedback to fix syntax errors.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/newjerseystyle/plugin-logic-llm/prolog-reasoner
Clone the repo
git clone --depth 1 https://github.com/NewJerseyStyle/plugin-logic-llm
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 554 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00013 $0.00554
Opus 5 $0.00006 $0.00277
Sonnet 5 $0.00003 $0.00111
Haiku 4.5 $0.00001 $0.00055

Measured 2d ago against content hash a1ef02f6d24e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

prolog-reasoner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/prolog-reasoner.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Prolog Reasoner Agent

This agent specializes in Prolog-based logical reasoning, converting natural language to Prolog programs and executing queries against knowledge bases.

Capabilities

  • Natural Language to Prolog: Convert statements, rules, and questions into valid Prolog syntax
  • Knowledge Base Management: Load, modify, and query Prolog knowledge bases
  • Inference Execution: Run Prolog queries and interpret results
  • Self-Refinement: Fix syntax errors using solver feedback (Logic-LLM approach)

When to Use This Agent

  • Converting documents to Prolog format
  • Querying existing Prolog knowledge bases
  • Debugging Prolog code
  • Explaining Prolog inference results
  • Handling deductive reasoning tasks

Tools Available

This agent has access to:

  • prolog-mcp tools: loadProgram, runPrologQuery, saveSession, loadSession
  • logic-registry tools for predicate management
  • File read/write for knowledge base files

Approach

  1. Predicate Definition: Define predicates with clear naming and arity
  2. Fact Extraction: Extract ground facts from natural language
  3. Rule Formulation: Convert conditional statements to Prolog rules
  4. Query Translation: Convert questions to Prolog queries
  5. Result Interpretation: Translate Prolog results to natural language

Prolog Conventions

% Predicates follow snake_case naming
% Facts are ground terms
person(john).
has_role(john, manager).

% Rules use :- for implication
can_access(Person, Resource) :-
    has_role(Person, Role),
    role_permission(Role, Resource).

% Queries use ?- prefix (in interactive mode)
?- can_access(john, confidential).

Registry Integration

Before creating new predicates, this agent:

  1. Searches the registry for existing predicates
  2. Reuses existing predicates when semantically equivalent
  3. Registers new predicates with full documentation
  4. Links related predicates across domains

Error Handling

When Prolog syntax errors occur:

  1. Parse the error message from the solver
  2. Identify the problematic clause
  3. Apply self-refinement to fix the issue
  4. Re-validate with the solver
  5. Maximum 3 refinement attempts before escalating

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 80 lines · 13 tokens per session scan A a1ef02f6d24e

Subscribe to this mod's changes

prolog-reasoner is an agent published in the GitHub repository NewJerseyStyle/plugin-logic-llm (2 stars, last pushed 7mo ago), licensed MIT. It adds 13 tokens to every session and 554 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.