Skip to content

ankka-reasoning

ankka-reasoning is a reasoning graph: a record of how beliefs form and change. Evidence is kept with where it came from, claims are derived from evidence, hypotheses compete to answer a question, and a belief is one holder's probability for one hypothesis. Nothing in it is ever edited, so any belief can be traced to its sources, read back as it stood on any past day, and set beside a belief that disagrees with it. It is an ankka application, and it keeps its graph in Neo4j through ankka's graph sink.

The three questions

A forecast, a recommendation or a decision usually survives as a number or a sentence, and the reasoning that produced it does not. Three questions then have no answer, and they are the ones ankka-reasoning is built to answer:

  • Where did this come from? Which claims the belief rests on, what evidence they derive from, and who published it.
  • What did we believe then? What the belief was on a past day, what evidence had been seen by then, and what arrived afterwards.
  • Why do these two disagree? Whether two holders saw different evidence, or weighed the same evidence differently.

Asking a model afterwards does not answer them: it writes a plausible argument at the moment it is asked, which is not the argument that was made. ankka-reasoning records the reasoning as it is stated, and every answer it gives is made of those records and nothing else.

A prediction market is the first domain it is built for. A market says the crowd puts an outcome at 38%, not why, and when the price moves to 61% nothing in the market says what changed.

The shape, in five lines

  • A writer sends records over HTTP: a question with its hypotheses, a holder, a source, evidence, a claim, a belief revision. Each is checked against the records already held and kept or refused by name.
  • Records are never edited. Thinking again is a new record linked to the old one: a claim that revises a claim, a belief revision that follows the one before.
  • Every record is published as a node and every link it stated as an edge, to a compacted Kafka topic, and ankka's graph sink keeps them in Neo4j. The graph database is a copy that can be emptied and rebuilt from the topic.
  • A reader asks for answers: why a belief changed, the case for a hypothesis, what was believed as of a date, where two holders differ. Each is a walk of the graph, made of records only.
  • A run of a blueprint writes records too, through tools, and every record it writes is held with its act: which run, of which version of the blueprint, in which step, as which worker. An answer says which run read the document that changed a belief.
  • The vocabulary is in layers. The belief layer names nothing of markets; the market layer adds markets and resolutions on top; the process layer adds runs and acts; each changes nothing beneath it.

How ankka-reasoning works. Writers, a person, a script or a test, send records to the ankka-reasoning service, which runs in an ankka project; and a run of the appraiser blueprint, hosted by the service on ankka's agent runtime, writes records through its tools, each with an act. Inside the service, Records holds one entity per record, never edited, and checks every rule against the service's own records; every record is kept in the service's Postgres database. Each change goes to the graph consumers, one per kind of record, which turn each record into a node and each link it stated into an edge and publish them as graph deltas to a compacted delta topic in Kafka under the contract ankka.graph-delta.v1. The graph sink, a second service in the same project that runs ankka's graph sink over ankka-contrib's Neo4j store, reads the topic and merges each delta into the graph database, Neo4j, which is a copy that can be emptied and rebuilt from the topic alone. Readers ask the service's Answers, which query the graph database, read only, and reply with records only. A write never waits for the graph.

An example

Will Company X launch Product Y this year? Every name and number here is made up, and the whole of this documentation uses it.

4 May    evidence   a filing, from "Company X filings"
         claim      "approval is pending and the launch date is uncertain"
                      derives from the filing · contradicts "it launches this year"
         belief     agent-a puts "it launches this year" at 0.38, resting on that claim

11 May   evidence   a notice, from "the regulator"
         claim      "the approval barrier has gone"
                      derives from the notice · supports "it launches this year"
                      revises the claim of 4 May
         belief     agent-a moves to 0.61, resting on the new claim
                      follows the belief revision of 4 May

The claim of 4 May is kept: it was right for its time. Asked why the belief went from 0.38 to 0.61, the service answers with the regulator's notice, the claim derived from it and the earlier claim it revised, each with its source. Asked what agent-a believed as of 6 May, it answers 0.38, resting on the first claim. Your first explanation does both with curl.

Where to start

For models and agents

This documentation is published in forms a model can read directly. llms.txt at the site root lists every page with a one-sentence description, llms-full.txt holds every page in one file, and each page is also served as Markdown at its own path with a .md suffix. The same pages are rendered as an agent skill, ankka-reasoning, in the repository.