[semantic-memory] Integrate Prolog-RLM semantic compiler and add independent projection lifecycle #44

Open
opened 2026-09-08 01:57:03 +00:00 by nsaspy · 9 comments
Owner

Parent: #4
Depends on: #1
Upstream: lost-rob0t/prolog-rlm#388

Goal

Add the adapter that takes an already-durable memory source and compiles its natural-language semantics through Prolog-RLM's reusable semantic compiler, without coupling source durability to projection success.

Required lifecycle

memory_remember
  -> durable source committed (#1)
  -> projection status = absent|pending|ready|failed|stale
  -> semantic_compile(source)
  -> validated semantic package
  -> projection commit

Source remember success must never be rolled back by semantic compilation failure.

API direction

Provide native library semantics equivalent to:

memory_symbolize(+MemoryId, +Options, -Outcome).
memory_projection_status(+MemoryId, -Outcome).
memory_projection_get(+MemoryId, +Options, -Outcome).
memory_projection_retry(+MemoryId, +Options, -Outcome).

Exact naming follows repository conventions.

Requirements

  • consume upstream IR/schema; do not fork it;
  • bind compile result to exact memory source version/hash;
  • preserve compiler run/fingerprint/model/provider metadata;
  • preserve source spans supporting each semantic record;
  • projection can be disabled and memory remains valid;
  • retry is idempotent for same source+compiler+schema inputs;
  • changed memory/source version creates a new projection generation rather than mutating old projection;
  • explicit model compilation usage is recorded separately from local memory operations;
  • cancellation/failure leaves no half-published current projection;
  • no model output is auto-consulted or gains execution authority.

Acceptance

  • Remember plain text through #1, then symbolize it through prolog-rlm#388.
  • A how to do X memory yields procedure/rule IR rather than only claims/entities.
  • Projection failure leaves exact source retrievable.
  • Store close/reopen preserves projection status and committed projection.
  • Same input/config retry does not duplicate semantic records.
  • New source version gets a distinct projection generation.
  • Every semantic record resolves to exact source memory/span/hash.
  • No semantic compiler dependency is required merely to use memory_remember/memory_get.
Parent: #4 Depends on: #1 Upstream: lost-rob0t/prolog-rlm#388 ## Goal Add the adapter that takes an already-durable memory source and compiles its natural-language semantics through Prolog-RLM's reusable semantic compiler, without coupling source durability to projection success. ## Required lifecycle ```text memory_remember -> durable source committed (#1) -> projection status = absent|pending|ready|failed|stale -> semantic_compile(source) -> validated semantic package -> projection commit ``` Source remember success must never be rolled back by semantic compilation failure. ## API direction Provide native library semantics equivalent to: ```prolog memory_symbolize(+MemoryId, +Options, -Outcome). memory_projection_status(+MemoryId, -Outcome). memory_projection_get(+MemoryId, +Options, -Outcome). memory_projection_retry(+MemoryId, +Options, -Outcome). ``` Exact naming follows repository conventions. ## Requirements - consume upstream IR/schema; do not fork it; - bind compile result to exact memory source version/hash; - preserve compiler run/fingerprint/model/provider metadata; - preserve source spans supporting each semantic record; - projection can be disabled and memory remains valid; - retry is idempotent for same source+compiler+schema inputs; - changed memory/source version creates a new projection generation rather than mutating old projection; - explicit model compilation usage is recorded separately from local memory operations; - cancellation/failure leaves no half-published current projection; - no model output is auto-consulted or gains execution authority. ## Acceptance - [ ] Remember plain text through #1, then symbolize it through prolog-rlm#388. - [ ] A `how to do X` memory yields procedure/rule IR rather than only claims/entities. - [ ] Projection failure leaves exact source retrievable. - [ ] Store close/reopen preserves projection status and committed projection. - [ ] Same input/config retry does not duplicate semantic records. - [ ] New source version gets a distinct projection generation. - [ ] Every semantic record resolves to exact source memory/span/hash. - [ ] No semantic compiler dependency is required merely to use `memory_remember`/`memory_get`.
Author
Owner

Scope clarification from #4/#388/#392: this adapter must treat the upstream compiler result as a general semantic package, not a procedure-only projection. Projection lifecycle, fingerprints, provenance, retries, stale status, and generation semantics must work uniformly for every upstream semantic record class and future compatible domain-vocabulary extensions.

Scope clarification from #4/#388/#392: this adapter must treat the upstream compiler result as a **general semantic package**, not a procedure-only projection. Projection lifecycle, fingerprints, provenance, retries, stale status, and generation semantics must work uniformly for every upstream semantic record class and future compatible domain-vocabulary extensions.
Author
Owner

Machine Spirit #399A downstream compiler contract

Depth 2A in prolog-rlm#399 refines what a successful semantic-compiler call may return.

Symbolic Memory should not duplicate or durably own Prolog-RLM's ephemeral Semantic Compilation Lattice (SCL). The SCL is compiler-local evidence/hypothesis state. This repository should consume the resulting validated #392 records plus a bounded compiler receipt sufficient to explain interpretation provenance.

Projection lifecycle must therefore tolerate outcomes equivalent to:

ready                 validated semantic records committed
ready_with_ambiguity  validated records + intentionally unresolved alternatives
partial               some source regions accepted; material regions rejected/unresolved
failed                no publishable coherent projection for required unit
stale                 source/compiler/schema changed

Exact status vocabulary should follow repository conventions; the important invariant is unresolved semantic ambiguity is not automatically compiler failure and must not be silently collapsed before persistence.

For committed records retain interpretation provenance sufficient to traverse:

exact source span
 -> compiler/analyzer observations (bounded refs/digests)
 -> semantic hypothesis/reconciliation decision
 -> normalized #392 record

Do not treat parser/model confidence as world/source trust. Compiler confidence concerns interpretation only.

If an induced_rule, pragmatic_candidate, cross_sentence_synthesized, or compiler_repair result is persisted, preserve that induction class separately from source trust/authority.

This does not change #1's source-durability invariant and does not authorize storing every temporary parser hypothesis forever.

## Machine Spirit #399A downstream compiler contract Depth 2A in `prolog-rlm#399` refines what a successful semantic-compiler call may return. Symbolic Memory should **not** duplicate or durably own Prolog-RLM's ephemeral Semantic Compilation Lattice (SCL). The SCL is compiler-local evidence/hypothesis state. This repository should consume the resulting validated #392 records plus a bounded compiler receipt sufficient to explain interpretation provenance. Projection lifecycle must therefore tolerate outcomes equivalent to: ```text ready validated semantic records committed ready_with_ambiguity validated records + intentionally unresolved alternatives partial some source regions accepted; material regions rejected/unresolved failed no publishable coherent projection for required unit stale source/compiler/schema changed ``` Exact status vocabulary should follow repository conventions; the important invariant is **unresolved semantic ambiguity is not automatically compiler failure and must not be silently collapsed before persistence**. For committed records retain interpretation provenance sufficient to traverse: ```text exact source span -> compiler/analyzer observations (bounded refs/digests) -> semantic hypothesis/reconciliation decision -> normalized #392 record ``` Do not treat parser/model confidence as world/source trust. Compiler confidence concerns interpretation only. If an `induced_rule`, `pragmatic_candidate`, `cross_sentence_synthesized`, or `compiler_repair` result is persisted, preserve that induction class separately from source trust/authority. This does not change #1's source-durability invariant and does not authorize storing every temporary parser hypothesis forever.
Author
Owner

Machine Spirit depth 2B downstream semantic-projection requirement

Upstream prolog-rlm#399B/#393 now distinguishes linguistic commitment/derivation from world epistemic status via compiler-local SCL/SCC plus an export receipt.

memory_symbolize should persist the final exported semantic distinction + export receipt, not the ephemeral compiler lattice itself.

Hard downstream invariants:

source assertion != presupposition
presupposition != pragmatic candidate
pragmatic candidate != induced rule
reconstructed ellipsis != literal source wording
reported/quoted/modal content != actual-world assertion
generic/habitual != exceptionless universal/specific event
metonymic coercion != entity identity

A newer compiler may create a new projection generation with a different interpretation, but old projection lineage remains inspectable. Never rewrite an older presupposed/pragmatic/reconstructed record so it later appears source-explicit.

For every material projection record, preserve enough of the upstream export receipt to trace:

  • source/span;
  • linguistic force;
  • compiler derivation class;
  • context/holder;
  • exported semantic class;
  • compiler/schema/config identity.

This keeps source durability independent from interpretation while allowing later #400 epistemics to reason over the distinction.

## Machine Spirit depth 2B downstream semantic-projection requirement Upstream `prolog-rlm#399B/#393` now distinguishes linguistic commitment/derivation from world epistemic status via compiler-local SCL/SCC plus an export receipt. `memory_symbolize` should persist the **final exported semantic distinction + export receipt**, not the ephemeral compiler lattice itself. Hard downstream invariants: ```text source assertion != presupposition presupposition != pragmatic candidate pragmatic candidate != induced rule reconstructed ellipsis != literal source wording reported/quoted/modal content != actual-world assertion generic/habitual != exceptionless universal/specific event metonymic coercion != entity identity ``` A newer compiler may create a new projection generation with a different interpretation, but old projection lineage remains inspectable. Never rewrite an older presupposed/pragmatic/reconstructed record so it later appears source-explicit. For every material projection record, preserve enough of the upstream export receipt to trace: - source/span; - linguistic force; - compiler derivation class; - context/holder; - exported semantic class; - compiler/schema/config identity. This keeps source durability independent from interpretation while allowing later #400 epistemics to reason over the distinction.
Author
Owner

Upstream Machine Spirit #399C projection-lineage requirement

Semantic projections must now bind the interoperability lineage used by the Prolog-RLM compiler, not only source/compiler/model/schema versions.

Persist replay-critical references/fingerprints for:

analyzer manifests + versions/configs
formalism/schema versions
mapping bundle versions
lexical/ontology mapping versions
cross-lingual/translation mapping receipts where material
external-format conversion/loss receipts

Hard invariants:

  • a new mapping/analyzer/ontology version creates a new projection generation when semantics may change; it never silently reinterprets an old projection;
  • historical projections remain reproducible/inspectable under their original mapping lineage;
  • mapping confidence is representational correspondence confidence, separate from source/world truth and compiler interpretation confidence;
  • native analyzer blobs are not required to be durably copied by default; source + accepted #392 semantics + replay-critical receipts are the durable minimum, with optional content-addressed artifact retention;
  • lossy conversion cannot become a clean projection without the corresponding loss receipt;
  • translation/cross-language mapping never upgrades attributed/presupposed/pragmatic content into world truth;
  • mapping/translation/entity alignment cannot grant authority or rebind principals.

See lost-rob0t/prolog-rlm#399 subpass C for the full Semantic Interoperability Fabric design.

## Upstream Machine Spirit #399C projection-lineage requirement Semantic projections must now bind the **interoperability lineage** used by the Prolog-RLM compiler, not only source/compiler/model/schema versions. Persist replay-critical references/fingerprints for: ```text analyzer manifests + versions/configs formalism/schema versions mapping bundle versions lexical/ontology mapping versions cross-lingual/translation mapping receipts where material external-format conversion/loss receipts ``` Hard invariants: - a new mapping/analyzer/ontology version creates a new projection generation when semantics may change; it never silently reinterprets an old projection; - historical projections remain reproducible/inspectable under their original mapping lineage; - mapping confidence is representational correspondence confidence, separate from source/world truth and compiler interpretation confidence; - native analyzer blobs are **not required** to be durably copied by default; source + accepted #392 semantics + replay-critical receipts are the durable minimum, with optional content-addressed artifact retention; - lossy conversion cannot become a clean projection without the corresponding loss receipt; - translation/cross-language mapping never upgrades attributed/presupposed/pragmatic content into world truth; - mapping/translation/entity alignment cannot grant authority or rebind principals. See lost-rob0t/prolog-rlm#399 subpass C for the full Semantic Interoperability Fabric design.
Author
Owner

Upstream Machine Spirit #399D projection replay requirement

Depth 2D distinguishes semantic projection lineage from execution replay class.

memory_symbolize / projection metadata should retain enough upstream compile-receipt state to distinguish:

exact_artifact_replay
deterministic_rebuild
semantic_recompile_required

Hard invariants:

  • a model/provider request fingerprint is not proof of reproducible output;
  • exact historical replay of model-backed compilation requires the retained candidate/output artifact (or an equivalent immutable artifact supplied by policy);
  • if such an artifact was intentionally not retained, a future rebuild is a new semantic compilation generation, not a claim that the old interpretation was reproduced;
  • deterministic source/analyzer/mapping artifacts may be reused independently by digest;
  • projection generation records the exact semantic work/compile receipt lineage used to produce it;
  • cache presence never changes semantic truth/authority semantics;
  • a partial upstream compile can commit only under an explicit downstream completeness policy and must persist material semantic-gap refs;
  • old projection generations remain inspectable even when newer analyzer/mapping/model generations reinterpret the same source.

Symbolic Memory owns durable retention policy; Prolog-RLM only defines the artifact/replay contract and remains usable without this repository.

Full rationale and execution model: lost-rob0t/prolog-rlm#399D.

## Upstream Machine Spirit #399D projection replay requirement Depth 2D distinguishes **semantic projection lineage** from **execution replay class**. `memory_symbolize` / projection metadata should retain enough upstream compile-receipt state to distinguish: ```text exact_artifact_replay deterministic_rebuild semantic_recompile_required ``` Hard invariants: - a model/provider request fingerprint is not proof of reproducible output; - exact historical replay of model-backed compilation requires the retained candidate/output artifact (or an equivalent immutable artifact supplied by policy); - if such an artifact was intentionally not retained, a future rebuild is a **new semantic compilation generation**, not a claim that the old interpretation was reproduced; - deterministic source/analyzer/mapping artifacts may be reused independently by digest; - projection generation records the exact semantic work/compile receipt lineage used to produce it; - cache presence never changes semantic truth/authority semantics; - a partial upstream compile can commit only under an explicit downstream completeness policy and must persist material semantic-gap refs; - old projection generations remain inspectable even when newer analyzer/mapping/model generations reinterpret the same source. Symbolic Memory owns durable retention policy; Prolog-RLM only defines the artifact/replay contract and remains usable without this repository. Full rationale and execution model: lost-rob0t/prolog-rlm#399D.
Author
Owner

Machine Spirit #402A projection-commit handoff

Depth 5A (prolog-rlm#402A) sharpens this issue's independent projection lifecycle:

  • semantic compilation remains independent of source durability as already specified;
  • a completed projection is published through one atomic ledger commit batch, not by mutating a current projection snapshot in place;
  • projection retries use a stable command/work identity plus canonical batch digest so crash/network retry is idempotent;
  • compiler artifact replay and projection commit idempotency are separate concerns: retained compiler output may be reused, while the downstream ledger still decides whether the semantic projection event batch is already committed;
  • a changed source/compiler/schema/mapping generation creates new immutable projection lineage plus lifecycle events; it never overwrites the earlier projection generation;
  • projection status/current tables may be cached/materialized, but their authority is bounded by ledger frontier + dependency-version checkpoint.

This should compose directly with #399D's compiler replay classes and symbolic-memory#6's BSLPF ledger contract. No storage ownership moves into Prolog-RLM.

## Machine Spirit #402A projection-commit handoff Depth 5A (`prolog-rlm#402A`) sharpens this issue's independent projection lifecycle: - semantic compilation remains independent of source durability as already specified; - a completed projection is published through one **atomic ledger commit batch**, not by mutating a current projection snapshot in place; - projection retries use a stable command/work identity plus canonical batch digest so crash/network retry is idempotent; - compiler artifact replay and **projection commit idempotency are separate concerns**: retained compiler output may be reused, while the downstream ledger still decides whether the semantic projection event batch is already committed; - a changed source/compiler/schema/mapping generation creates new immutable projection lineage plus lifecycle events; it never overwrites the earlier projection generation; - projection status/current tables may be cached/materialized, but their authority is bounded by ledger frontier + dependency-version checkpoint. This should compose directly with #399D's compiler replay classes and symbolic-memory#6's BSLPF ledger contract. No storage ownership moves into Prolog-RLM.
Author
Owner

MACHINE-SPIRIT #402B handoff — projection publication/integrity

Projection lifecycle now depends on GRIE from prolog-rlm#402B. A projection generation is publishable only against an exact source/ledger frontier plus schema/upcaster/admission/redaction/integrity generations. Staged immutable objects may exist before commit, but no half-package becomes active until one atomic publication group validates every mandatory ref/digest.

Add lifecycle outcomes for at least quarantined, integrity_failed, source_redacted/replay-degraded where applicable. An upcaster is a versioned interpretation artifact; semantic-changing migration cannot be labeled exact historical replay. A stale/corrupted projection is discarded/rebuilt and may never append or repair canonical history by itself.

Full mechanisms/fixtures: prolog-rlm#402B.

## MACHINE-SPIRIT #402B handoff — projection publication/integrity Projection lifecycle now depends on GRIE from prolog-rlm#402B. A projection generation is publishable only against an exact source/ledger frontier plus schema/upcaster/admission/redaction/integrity generations. Staged immutable objects may exist before commit, but **no half-package becomes active** until one atomic publication group validates every mandatory ref/digest. Add lifecycle outcomes for at least `quarantined`, `integrity_failed`, `source_redacted`/replay-degraded where applicable. An upcaster is a versioned interpretation artifact; semantic-changing migration cannot be labeled exact historical replay. A stale/corrupted projection is discarded/rebuilt and may never append or repair canonical history by itself. Full mechanisms/fixtures: prolog-rlm#402B.
Author
Owner

MACHINE-SPIRIT #402C handoff — external/federated projection admission

External projection/import work needs a stable identity stronger than source text alone: remote logical-ledger ID + authenticated remote event/statement identity + digest + observed remote frontier/checkpoint + federation-link/adapter version.

Re-import of the same authenticated identity+digest is idempotent. Reuse of the same remote identity with a different digest is an integrity conflict, not a new projection generation. External schema/provenance formats (e.g. PROV or signed/transparency envelopes) remain inert typed input; adapters record exact/lossy/unsupported interpretation and cannot import remote authority.

Projection publication is still independent of exact-source durability and remains atomic. Full CLFM design: prolog-rlm#402C.

### MACHINE-SPIRIT #402C handoff — external/federated projection admission External projection/import work needs a stable identity stronger than source text alone: remote logical-ledger ID + authenticated remote event/statement identity + digest + observed remote frontier/checkpoint + federation-link/adapter version. Re-import of the same authenticated identity+digest is idempotent. Reuse of the same remote identity with a different digest is an integrity conflict, not a new projection generation. External schema/provenance formats (e.g. PROV or signed/transparency envelopes) remain inert typed input; adapters record exact/lossy/unsupported interpretation and cannot import remote authority. Projection publication is still independent of exact-source durability and remains atomic. Full CLFM design: prolog-rlm#402C.
Author
Owner

Implementation decomposition

#5 remains the canonical requirement for independent semantic projection lifecycle. Its focused implementation slice is #22.

Downstream continuation:

#22 compiler adapter/projection lifecycle
 -> #23 append-only semantic commit
 -> #31 resumable corpus/backfill runner
 -> #32 structured source adapters

Do not add corpus scheduling/backfill orchestration directly to #5's adapter layer; keep source durability independent from projection success.

## Implementation decomposition #5 remains the canonical requirement for independent semantic projection lifecycle. Its focused implementation slice is **#22**. Downstream continuation: ```text #22 compiler adapter/projection lifecycle -> #23 append-only semantic commit -> #31 resumable corpus/backfill runner -> #32 structured source adapters ``` Do not add corpus scheduling/backfill orchestration directly to #5's adapter layer; keep source durability independent from projection success.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/symbolic-memory#44
No description provided.