Skip to content
Skillpedia
Analysis & spreadsheets14k · #11155

reason

What it does

This skill applies logical reasoning to facts in a Semantica knowledge graph to reach conclusions or propose explanations. It is for people who want the graph to draw inferences from rules they define.

When to use it

  • ✓When you have facts and rules and want the graph to work out the conclusions.
  • ✓When you have an observation and want possible explanations for it.
  • ✓When you want to check whether a stated claim follows from the known facts.

Skill link

https://github.com/semantica-agi/semantica/blob/main/plugins/skills/reason/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/semantica-agi/semantica/blob/main/plugins/skills/reason/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Given these facts about our suppliers and this rule, can you work out which suppliers are not allowed to bid?”

5 new skills a week. 1 minute to read.

How it works

The agent adds your facts and rules to a reasoning engine, applies them to reach conclusions, and reports each conclusion with the rule that produced it. It can also try to prove a statement and generate hypotheses to explain observations.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

/semantica:reason

Apply reasoning over the knowledge graph. Usage: /semantica:reason <mode> [args]

$ARGUMENTS = reasoning mode + rules/observations/query.


deductive [--facts '<json-list>'] [--rules '<rule1>|<rule2>']

Apply deductive rules to known facts to derive new conclusions.

from semantica.reasoning.deductive_reasoner import DeductiveReasoner, Premise

reasoner = DeductiveReasoner()

# Add base facts to working memory
# Facts can be strings like "Person(John)" or structured dicts
import json
facts = json.loads(facts_json) if facts_json else []
reasoner.add_facts(facts)

# Apply logic with explicit premises
# Premise objects have: statement, confidence, source
premises = [
    Premise(statement=fact, confidence=1.0)
    for fact in facts
]

conclusions = reasoner.apply_logic(premises=premises)

Return: | Conclusion | Triggering Premises | Confidence | Rule Applied |

If zero rules given, run reasoner.prove_theorem() on any provided theorem:

proof = reasoner.prove_theorem(theorem=theorem_text)

Output: Proof: <proof.steps> | Valid: YES / NO


prove <theorem> [--facts '<json-list>']

Prove or disprove a theorem against known facts.

from semantica.reasoning.deductive_reasoner import DeductiveReasoner

reasoner = DeductiveReasoner()
import json
reasoner.add_facts(json.loads(facts_json) if facts_json else [])

proof = reasoner.prove_theorem(theorem=theorem)

Output:

Theorem: "<theorem>"
Result:  PROVED ✓  |  DISPROVED ✗  |  UNDECIDABLE ⚠

Proof steps:
  1. <premise> — <justification>
  2. ...
  → QED: <theorem>

Confidence: <proof.confidence>

abductive <observation> [--knowledge '<json-list>'] [--top N]

Generate and rank hypotheses that explain an observation.

from semantica.reasoning.abductive_reasoner import (
    AbductiveReasoner, Observation
)

reasoner = AbductiveReasoner()

import json
if knowledge_json:
    reasoner.add_knowledge(json.loads(knowledge_json))

obs = Observation(description=observation)

# Generate all hypotheses then rank them
hypotheses = reasoner.generate_hypotheses(observations=[obs])
ranked = reasoner.rank_hypotheses(hypotheses)
best = reasoner.get_best_explanation(obs)

# Also get full explanations with evidence
explanations = reasoner.find_explanations(observations=[obs])

Output:

Abductive Reasoning for: "<observation>"

Best explanation:
  <best.description>  (confidence: 0.87)

All hypotheses (ranked):
  | Rank | Hypothesis | Confidence | Supporting Evidence |
  |  1   | <hyp>      | 0.87       | <evidence>         |
  |  2   | ...

Full explanations:
  Explanation 1: <explanation.summary>
    Evidence: <evidence items>

datalog <program>

Evaluate a Datalog program over graph facts.

from semantica.reasoning.datalog_reasoner import DatalogReasoner
from semantica.context import ContextGraph

graph = ContextGraph()
reasoner = DatalogReasoner()

# program is a string of Datalog rules and queries
results = reasoner.evaluate(program=program, graph=graph)

Return derived tuples as a relation table. Show rule derivation counts.


sparql <query>

Run a SPARQL query over the knowledge graph and return results.

from semantica.reasoning.sparql_reasoner import SPARQLReasoner
from semantica.context import ContextGraph

graph = ContextGraph()
reasoner = SPARQLReasoner()

results = reasoner.query(sparql_query=query, graph=graph)

Return as a Markdown table with bound variable columns matching the SELECT clause.


rete [--rules '<rule1>|<rule2>'] [--facts '<json-list>']

Incremental rule evaluation using the Rete network with working memory.

from semantica.reasoning.rete_engine import ReteEngine
import json

engine = ReteEngine()

rules = rules_str.split("|") if rules_str else []
facts = json.loads(facts_json) if facts_json else []

engine.load_rules(rules)
engine.process_facts(facts)
activations = engine.get_activations()

Return: | Rule Fired | Variable Bindings | Working Memory Delta | Activation Order |


hypotheses "<scenario>" [--knowledge '<json-list>'] [--top N]

Generate the top-N most probable explanations for a complex scenario.

from semantica.reasoning.abductive_reasoner import AbductiveReasoner, Observation
import json

reasoner = AbductiveReasoner()
if knowledge_json:
    reasoner.add_knowledge(json.loads(knowledge_json))

obs = Observation(description=scenario)
hypotheses 
FAQ

What is abductive reasoning?

It is reasoning from an observation back to the most likely explanations.

Can it prove a statement?

Yes. It can check a theorem against known facts and report whether the proof holds.

What rule styles does it support?

It supports several, including Datalog programs, SPARQL queries and Rete network evaluation.

Details

Original description by the author

Run reasoning over the Semantica knowledge graph — deductive logic, abductive hypothesis generation, Datalog programs, SPARQL queries, Rete network evaluation. Uses DeductiveReasoner, AbductiveReasoner, DatalogReasoner, SPARQLReasoner, ReteEngine. Sub-commands: deductive, abductive, datalog, sparql, rete, prove, hypotheses.

repo: semantica-agi/semantica

Popularity

GitHub stars
14k
Ranking position
#11155
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills