Skills

Reason

Run reasoning over the Semantica knowledge graph, deductive logic, abductive...

Install

npx skills add semantica-agi/semantica --skill reason -g -a claude-code -y
Category
Engineering
Updated
3d ago
License
MIT
Context cost
Lightabout 1,194 tokens
Runs scripts
No, instructions only

What it does

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.

/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()
Read the whole SKILL.md on GitHub

More in Engineering