Reasons Forge
A belief forge built on Doyle's (1979) Truth Maintenance System. Ingest domain sources, extract beliefs, derive new knowledge, and maintain consistency — all backed by automatic retraction cascades and dependency-directed backtracking.
What It Does
Reasons Forge analyzes domain-specific sources (codebases, issue trackers, product data, documents) and builds a dependency network of beliefs. The TMS engine tracks which beliefs are IN (believed) or OUT (retracted), automatically propagating changes when evidence shifts.
Core TMS engine:
- Nodes with SL/CP justifications and non-monotonic reasoning (outlist)
- Retraction cascades and automatic restoration
- Nogoods with dependency-directed backtracking
- Dialectical argumentation (challenge/defend)
- Merkle integrity verification
Domain-specific forges:
document— PDFs, markdown, and code files with section-based chunkingcode— Codebase architecture, patterns, invariants, and technical debtproject— Team velocity, milestone health, and delivery risks from issue trackersproduct— Feature readiness, user experience, and product-market fitmeta— Cross-domain reasoning across expert belief networks
LLM-powered analysis:
derive— generate new beliefs from existing onesreview-beliefs— validate derived beliefscontradictions— detect contradictions between IN beliefsverify— re-examine beliefs against source documentsrepair— fix invalid beliefs (search-and-link, soften, abandon)deduplicate— find and merge duplicate beliefsask— natural language questions over the belief network
Install
pip install reasonsforge
Or with uv:
uv tool install reasonsforge
For forge features (PDF chunking, issue tracker sources):
pip install reasonsforge[forge]
Quick Start
Core TMS
# Initialize database
reasonsforge init
# Add premises
reasonsforge add source-uses-langgraph "Source code uses LangGraph" --source "src/graph.py"
reasonsforge add graph-has-cycles "Graph contains cycles"
# Add derived nodes with SL justifications
reasonsforge add topology-is-static "Graph topology is static" --sl source-uses-langgraph
reasonsforge add no-runtime-modification "No runtime graph modification" --sl topology-is-static
# See what's believed
reasonsforge status
# [+] graph-has-cycles: Graph contains cycles (premise)
# [+] no-runtime-modification: No runtime graph modification (1 justification)
# [+] source-uses-langgraph: Source code uses LangGraph (premise)
# [+] topology-is-static: Graph topology is static (1 justification)
#
# 4/4 IN
# Retract a premise — cascade propagates
reasonsforge retract source-uses-langgraph
# Retracted: source-uses-langgraph, topology-is-static, no-runtime-modification
# Restore — dependents come back automatically
reasonsforge assert source-uses-langgraph
# Asserted: source-uses-langgraph, topology-is-static, no-runtime-modification
# Record a contradiction
reasonsforge add graph-is-dynamic "Graph is dynamically modified"
reasonsforge nogood topology-is-static graph-is-dynamic
# Recorded nogood-001: topology-is-static, graph-is-dynamic
# Retracted: graph-is-dynamic
# Explain why a node is IN or OUT
reasonsforge explain no-runtime-modification
# Non-monotonic reasoning: believe X unless Y
reasonsforge add default-approx "Newtonian approximation holds" --unless strong-field
# LLM-powered derivation
reasonsforge derive --sample -m claude
# Export
reasonsforge export -o network.json
reasonsforge export-markdown -o beliefs.md
Forges
Forges are domain-specific pipelines that automate the full cycle: ingest sources, summarize, extract beliefs, derive, review, and repair.
# Analyze a codebase
reasonsforge forge code --repo /path/to/repo
# Analyze a codebase step by step
reasonsforge forge code scan --repo /path/to/repo
reasonsforge forge code explore --repo /path/to/repo --loop 50
reasonsforge forge code propose-beliefs --auto
reasonsforge forge code derive --exhaust --auto
# Analyze project state from GitHub issues
reasonsforge forge project --github owner/repo
# Analyze product data from an issue tracker
reasonsforge forge product --github owner/repo
# Ingest product documents
reasonsforge forge product ingest docs/ --glob-pattern "**/*.md"
# Analyze a PDF (chunked by section, then summarized)
reasonsforge forge document --pdf paper.pdf
# Cross-domain synthesis across expert belief networks
reasonsforge forge meta init code=/path/to/code-expert project=/path/to/project-expert
reasonsforge forge meta import
reasonsforge forge meta derive --auto
reasonsforge forge meta contradictions --auto
reasonsforge forge meta summary
# Full meta pipeline in one command
reasonsforge forge meta update
Commands
Core TMS
| Command | Description |
|---|---|
init |
Create reasons.db |
add ID "text" |
Add a premise |
add ID "text" --sl a,b |
Add with SL justification |
add ID "text" --unless y |
Add with outlist (non-monotonic) |
retract ID |
Mark OUT + cascade |
assert ID |
Mark IN + restore dependents |
status |
Show all nodes with truth values |
show ID |
Node details, justifications, dependents |
explain ID |
Trace why a node is IN or OUT |
trace ID |
Find all premises a conclusion rests on |
propagate |
Recompute all truth values |
log |
Propagation audit trail |
Dialectical
| Command | Description |
|---|---|
challenge ID "reason" |
Challenge a node — target goes OUT |
defend TARGET CHALLENGE "reason" |
Defend — target restored |
nogood A B ... |
Record contradiction, backtrack to responsible premise |
Search & Query
| Command | Description |
|---|---|
search QUERY |
Full-text search |
list |
Filter by --status, --premises, --has-dependents, --challenged |
ask QUESTION |
Natural language question over the network |
compact |
Token-budgeted summary (--budget N) |
LLM Analysis
| Command | Description |
|---|---|
derive |
Generate new beliefs from existing ones |
review-beliefs |
Validate derived beliefs |
contradictions |
Detect contradictions |
verify |
Re-examine against source documents |
repair |
Fix invalid beliefs |
deduplicate |
Find and merge duplicates |
Import & Export
| Command | Description |
|---|---|
import-beliefs FILE |
Import beliefs.md registry |
import-json FILE |
Import from JSON |
export |
Export as JSON |
export-markdown |
Export as beliefs.md |
export-card |
Export as HuggingFace model card |
check-stale |
Check for source file changes |
hash-sources |
Backfill source hashes |
Forge Commands
| Forge | Subcommands |
|---|---|
forge document |
Full pipeline from PDFs/markdown with chunking |
forge code |
scan, explore, explain, walk-commits, propose-beliefs, accept-beliefs, review-proposals, verify, derive, topics, status, update |
forge project |
init, scan, explore, propose-beliefs, accept-beliefs, review-proposals, research, derive, review-beliefs, repair, summary, sprint-plan, topics, status, update |
forge product |
init, scan, ingest, explore, propose-beliefs, accept-beliefs, review-proposals, derive, generate-summary, summary, topics, status, update |
forge meta |
init, import, derive, ask, contradictions, summary, topics, status, update |
Forge Pipeline Steps
| Command | Description |
|---|---|
forge init NAME |
Initialize a forge project |
forge chunk-pdf FILE |
Chunk a PDF into section entries |
forge chunk-docs |
Chunk large documents by heading |
forge summarize |
Summarize source documents with LLM |
forge propose-beliefs |
Extract candidate beliefs from summaries |
forge accept-beliefs |
Import accepted beliefs |
forge pipeline |
End-to-end belief construction |
forge derive-review-repair |
Convergence loop |
forge index-sources |
Build FTS5 search index |
Tests
uv run --extra test pytest tests/ -v
1,732 tests covering propagation, retraction cascades, restoration, multiple justifications, diamond dependencies, nogoods, dependency-directed backtracking, non-monotonic justifications, dialectical argumentation, Merkle integrity, SQLite round-trips, import/export, and more.
References
Doyle, J. (1979). A Truth Maintenance System. Artificial Intelligence, 12(3), 231–272.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reasonsforge-0.69.0.tar.gz.
File metadata
- Download URL: reasonsforge-0.69.0.tar.gz
- Upload date:
- Size: 479.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35c7d7a12e3365bd6872afe0b49d31f433d61546b1ab156eda5bf40570332c72
|
|
| MD5 |
ae6c92941602745e978e121e60393313
|
|
| BLAKE2b-256 |
f00aec69831fc37b296bcc5cdf5c6df8d31b6c4f4234965c133469436ec35e8f
|
File details
Details for the file reasonsforge-0.69.0-py3-none-any.whl.
File metadata
- Download URL: reasonsforge-0.69.0-py3-none-any.whl
- Upload date:
- Size: 380.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9475519df43889fd4cbd84a8c7b2852d26e7196e49d49e43349a1d06334e2a1a
|
|
| MD5 |
7e739d0f509ed0b3021e7b29db374375
|
|
| BLAKE2b-256 |
9b75bc1406de466b0a2547825d703b558d87e3f637f66f15f6f5c2d9922d8c18
|