# Reason

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

- Repository: https://github.com/semantica-agi/semantica (14373 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add semantica-agi/semantica --skill reason -g -a claude-code -y`
Codex: `npx skills add semantica-agi/semantica --skill reason -g -a codex -y`
Cursor: `npx skills add semantica-agi/semantica --skill reason -g -a cursor -y`
Gemini CLI: `npx skills add semantica-agi/semantica --skill reason -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# /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.

```python
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:
```python
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.

```python
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.

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

reasoner = AbductiveReasoner()

The rest: https://github.com/semantica-agi/semantica/blob/HEAD/plugins/skills/reason/SKILL.md
