[EPIC] Add durable scoped state and Prolog-native project policy configuration #432
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#432
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add a reusable core substrate for durable scoped operator state and trusted policy/configuration so downstream agents and tool packs can build project-local Prolog configuration and remembered permissions without turning
prolog-rlminto a coding-agent-specific configuration product.The motivating user experience is semantically equivalent to:
The persistent project choice must survive restart, remain isolated to the project, and authorize only the deliberately matched operation or bounded operation class. It must not become machine-global authority and must never silently become
dangerous.Analysis basis when this epic was created:
mainat7b527750a64d5cbd9fff79413a399a8c69e90c75(Harden declarative MCP execution policy (#72)).Problem / motivation
The repository now has several intentionally different kinds of state, but no generic substrate for durable trusted operator settings/policy:
rlm_authorityowns mutable runtime authority state, exact pending-operation fingerprints, approval lifecycle, and the four authority tiers.allow_sessionis intentionally non-persistent.rlm_artifactowns immutable/versioned durable reasoning artifacts, blackboards, summaries, findings, provenance, and fresh-root handoff.None of those means:
Trying to stuff that meaning into artifact records, MCP facts, context facts, authority event history, or a generic
fact/7table would erase security/provenance distinctions that the current architecture deliberately preserves.Architectural boundary
prolog-rlmcore should own:Downstream hosts / agents / tool packs should own:
This is analogous in role to project-local agent configuration systems, but it must be designed natively for Prolog and the existing
prolog-rlmsecurity model rather than copying another product's file format or directory convention.Required state classes and scopes
At minimum establish explicit scopes equivalent to:
hostuserprojectsessionExact public terms may follow repository conventions.
These scopes are not all interchangeable. Ordinary settings may use deterministic overlay/precedence semantics. Authority-affecting state remains subordinate to current hard runtime policy and the trusted host ceiling.
Project identity
Project-scoped durable state must use a stable, explicit project identity contract. Persistent authority must not be keyed directly by the process current-working-directory string.
The design must address, without necessarily overbuilding the first slice:
The implementation issues should decide what is identity versus current location metadata and define deterministic behavior for ambiguous or stale cases.
Persistent operator settings and permissions
The core must be able to represent durable operator-selected state independently from model-generated context.
For persistent authorization, support at least two deliberately different matching classes:
A changed executable payload must not inherit an exact grant merely because rendered text looks similar.
Current #53 fingerprints include the authority context. #76 must therefore define deliberate composition with #53 rather than persisting an ephemeral runtime-context hash and hoping it means the same thing after restart.
Persistent permission is not a fifth authority tier.
dangerousremains explicit and separate.Precedence and authority
Do not treat preference overlay and security authority as the same algorithm.
The security direction must preserve the invariant:
Exact terms may change after reconciling with #53, but persisted state can never overpower a stricter current host/runtime policy.
A persistent grant also never substitutes for:
Revocation is first-class.
Prolog-native project policy/config packs
Downstream project configuration should be able to use Prolog-native data/rules instead of forcing JSON/YAML merely because it is fashionable to make every configuration language worse than the host language.
However, Prolog-native does not mean arbitrary auto-consulted repository code.
#77 must evaluate a safe boundary such as:
Repository/model terms must never be passed to unrestricted
call/1. Mere presence of a project file must not grant capabilities or widen authority.The concrete project-local filename/directory convention should remain downstream/extensible unless core genuinely requires a tiny provider discovery ABI.
Provenance and auditability
Active persisted state must be inspectable. Records should carry the repository-convention equivalent of:
Follow #64's lesson: active executable policy and retained audit/history are separate concerns. Do not turn an append-only history stream into the live authority registry or retain executable callables merely for auditability.
Security invariants
All children must preserve these invariants:
allow_sessionremains intentionally non-persistent.dangerousremains an explicit separate authority mode.call/1.Public API direction
The child issues should converge on host-facing APIs with semantics equivalent to:
Exact predicate names and records must follow current
prolog-rlmconventions after implementation design.Immediate/pure state operations do not need decorative async twins. If a future backend is genuinely latency-bearing, follow #54:
Interaction with existing modules/issues
#53 — authority
Reuse the existing authority boundary. Do not build
authority_v2or turn persistent project permission intoallow_sessionpersistence.#16 — artifacts
Artifacts remain durable task knowledge/fresh-root handoff. Publishing an artifact must never be equivalent to changing security policy.
#52 / #72 — MCP declarations and hard execution policy
MCP server/profile/config-reference facts remain a different class of trusted host configuration. Presence of an MCP server does not grant install/run/use permission. The new substrate may eventually hold user/project choices that refer to MCP configuration, but it must not collapse the categories.
#68-#71 — context/workflow pipeline
Context resolution may inspect effective project policy/config as operator state. Repository observations, research findings, design authority, and operator policy must retain distinct provenance/authority classes.
#48/#49/#50 — external tools
Reuse the architectural lesson: core owns stable contracts/security; external libraries and downstream agents own concrete catalogs/UX.
#54 — async contract
Do not invent duplicate sync/async business logic. Only latency-bearing backends require async surfaces.
#57 — effect identity
Persistent authorization matching must compose with canonical effect identity/accounting when applicable; it must not create a retry path that executes a side effect twice.
Child issues and dependency graph
#76 does not depend on #77: trusted UI/host-created project grants must work through #75 without requiring a project policy file/provider. Conversely, #77 may declare bounded policy profiles/configuration, but discovery/loading alone never creates a #76 grant.
Integration acceptance criteria
dangerousand without makingallow_sessionpersistent.Non-goals
.claudeclone in core.consult/1+call/1configuration execution path.allow_session.rlm_artifactas the permission database merely because it already persists ground terms.Dependencies / references
research/RLM-RESEARCH-003-typed-symbolic-execution.orgresearch/RLM-RESEARCH-005-swi-agent-runtime.orgresearch/RLM-RESEARCH-006-mcp-dual-version-runtime.orgresearch/RLM-RESEARCH-007-langchain-langgraph-port.orgresearch/RLM-RESEARCH-009-durable-artifact-context.orgRLM-RESEARCH-010is referenced by #56/#57 and exists on draft PR #58, but was not present onmainwhen this epic was designed; this epic does not invent or depend on unmerged contents.Duplicate of #74 (pre-existing Forgejo mirror with GitHub number parity). Closing this accidental duplicate created by today's open-state sync; #74 stays canonical on Forgejo.