Interface: ForwardChainRequest
@kortexya/reasoninglayer / ForwardChainRequest
Interface: ForwardChainRequest
Section titled “Interface: ForwardChainRequest”Defined in: src/types/inference.ts:551
Request for forward chaining inference.
Remarks
Section titled “Remarks”Serialization format: Uses untagged TermInputDto / FeatureInputValueDto.
Properties
Section titled “Properties”emitProvenance?
Section titled “emitProvenance?”
optionalemitProvenance?:boolean
Defined in: src/types/inference.ts:619
Emit W3C PROV-O lineage for this run (default: false).
Remarks
Section titled “Remarks”When true, the run’s derivation provenance (which rule and which antecedents
produced each derived fact) is reified into prov:wasDerivedFrom /
prov:wasAttributedTo Ψ-terms and persisted, so lineage becomes ordinary facts the
engine can query (OSFQL / backward chaining) and serialise (RDF export) — not an
opaque side index. Forces real derivation, bypassing the derivation cache.
Distinct from enableProvenanceTags, which attaches confidence scores to the response rather than persisting queryable lineage.
enableProvenanceTags?
Section titled “enableProvenanceTags?”
optionalenableProvenanceTags?:boolean
Defined in: src/types/inference.ts:574
Whether to include provenance tags (confidence scores) in the response.
initialFacts?
Section titled “initialFacts?”
optionalinitialFacts?:TermInputDto[]
Defined in: src/types/inference.ts:553
Initial facts (optional — uses existing facts if not provided).
keepDerived?
Section titled “keepDerived?”
optionalkeepDerived?:boolean
Defined in: src/types/inference.ts:572
KEEP the run’s derivations resident in the tenant’s store instead of
rolling them back, so a later MATCH reads them.
Remarks
Section titled “Remarks”Default false, and “ephemeral” means ROLLED BACK rather than merely
unwritten: the engine removes every wrapper and inner copy the run created
before it answers. So a default run reports a derivedCount and leaves the
store exactly as it found it — forward chaining is not a repair door.
To re-materialise a tenant use OSFQL CHAIN; or
AdminClient.rebuildDerivedFacts.
Not durable, and never was: the engine’s old write stored only the
meta.clause wrapper of each conclusion and never the inner ground copy a
reader returns, so nothing survived a restart. That write is gone, and the
flag now says what it always did. Named persistDerived until the engine
renamed the wire field to keep_derived.
maxFacts?
Section titled “maxFacts?”
optionalmaxFacts?:number
Defined in: src/types/inference.ts:578
Maximum number of facts to derive.
maxIterations?
Section titled “maxIterations?”
optionalmaxIterations?:number
Defined in: src/types/inference.ts:576
Maximum number of derivation iterations.
timeoutMs?
Section titled “timeoutMs?”
optionaltimeoutMs?:number|null
Defined in: src/types/inference.ts:605
A server-side deadline for this derivation, in milliseconds.
Remarks
Section titled “Remarks”The chainer checks it cooperatively — at every fixpoint-iteration boundary,
at every rule application, and inside each rule’s own candidate loop — and
the route answers 504 when it passes. Clamped by the engine’s
OSFKB_FC_TIMEOUT_SECS.
Omitted means that backstop (300 s by default), which is deliberately
longer than the safe-method one: a full materialisation over a large tenant
legitimately takes longer than a GET handler. 0 is the explicit opt-out.
A deadline does not change what the run keeps — keepDerived stays
the single switch. A truncated keepDerived: true run keeps the partial
derivation it reached, records provenance for every conclusion it stored
and announces it, so a re-run continues from it. A truncated default run
(keepDerived: false, answered 200 or 504) is rolled back and leaves
nothing stored. The 504 body says which happened.
A run also stops when its caller goes away: closing the connection (an
aborted signal, a client-side timeout) cancels the derivation at its next
fixpoint-iteration boundary, with or without this deadline, under the same
keepDerived rule as a truncated run. 0 opts out of the deadline, not
out of cancellation.