[P1] Define a safe Prolog-native project policy/config pack boundary #77
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#77
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?
Parent: #74
Depends on: #75
Goal
Define the safe extension boundary that lets downstream hosts/agents provide project-local Prolog-native settings, instructions, tool configuration, and bounded policy declarations on top of #75 without teaching core a coding-agent-specific
.claude-style product convention.The design conclusion from current architecture is:
“Prolog-native” means project policy/config can be represented naturally as Prolog data/relations. It does not mean auto-
consultarbitrary repository code and execute whatever predicates it contains.Problem / motivation
Downstream agents need a clean way to build a project-local experience containing things such as:
Core already has two useful precedents:
The same lesson should apply here. A downstream package needs an inspectable Prolog-native project policy/config boundary, but project repository content is not automatically trusted executable host policy.
Architectural boundary
Core should own
Downstream hosts/agents/tool packs should own
Do not make core depend on
agentPrologor any one downstream product.Provider model
Define a tiny trusted provider/registration ABI analogous in spirit to the tool-loader boundary.
The exact representation should be designed with current repository conventions, but a provider should have inspectable metadata equivalent to:
Provider discovery/catalog APIs must not return arbitrary trusted callables.
Multiple independent downstream providers should be able to contribute project configuration without name collisions becoming nondeterministic. Duplicate provider/declaration identities must fail structurally or follow an explicitly documented deterministic merge rule.
Safe Prolog-native declaration boundary
Evaluate and document the safest minimal mechanism consistent with current architecture. Viable directions include:
The implementation may combine these, but it must preserve one rule:
Do not implement:
Do not pass arbitrary project/model terms into unrestricted
call/1,once/1, meta-call, directive execution, term expansion, initialization hooks, or equivalent ambient execution paths.If ordinary Prolog modules are supported, the host must explicitly trust/register the module/provider before its executable code participates. The sanitized declarations consumed by core must still pass the closed schema.
Declaration classes
The provider contract should be extensible but start with explicit classes such as:
Ordinary settings
Closed key/value data resolved through #75's non-security scope precedence.
Project instructions
Structured/textual operator/project instructions with explicit provenance. They may be consumed by #70/#68-#71 as operator/project configuration, not silently treated as repository facts of equal authority.
Tool/MCP configuration references
References to installed/declared tool packs, categories, MCP server/profile/config references, or downstream tool settings.
A reference means “configure/select this thing,” not “grant capability” or “authorize its side effects.” Preserve #48/#52/#72 boundaries.
Bounded permission-profile declarations
A project policy pack may declare or select a bounded operation profile understood by #76, but declaration alone does not create a durable authorization grant.
Core must distinguish:
A profile that can affect authorization must use a closed trusted matcher schema and stable identity/version. Untrusted project data cannot inject executable matching predicates.
Trust classes
The API must distinguish at least conceptually between:
Exact names may follow repository conventions.
A project declaration may be useful configuration without being allowed to widen authority. Prefer fail-safe semantics where project-local configuration can select/constrain known trusted profiles but cannot manufacture new host execution authority by itself.
If a host explicitly allows a provider to contribute authority-relevant declarations, that trust decision must be visible, bounded, and still subordinate to #76/#53 host ceilings. There must be no “trusted because it was in Git” rule. Humanity has suffered enough from executable config files.
Discovery and project-local convention
Do not hard-code a filename merely to imitate another agent product.
The implementation/design should compare:
Given the current #48 loader architecture, the default direction should be:
If core grows project discovery, it should be neutral and return candidate locations/providers as data; it must not auto-execute arbitrary discovered code.
Load / unload / reload semantics
Define deterministic lifecycle behavior:
Loading a provider/project pack must be inert with respect to capability and authority.
Reload must never widen policy merely because a new declaration appeared. Authority-affecting changes that would alter an existing #76 grant's matcher identity/version must require explicit revalidation/re-authorization according to #76.
Public API direction
Exact predicate names must follow repository conventions. Core should expose semantics equivalent to:
Illustrative only. Trusted provider callables/reader internals must remain private like the tool-loader ABI; catalog/discovery returns sanitized declarative information.
Pure/local loading need not gain fake async twins. If a downstream provider genuinely performs latency-bearing external I/O, it should follow #54 internally through the canonical async contract and explicit capabilities rather than making the core project-policy API magically ambient-network-aware.
Security invariants
consult+ unrestricted meta-call boundary.dangerousremains explicit host/user authority and is never implied by a project pack.Interaction with existing modules/issues
#75
Owns scopes, project identity, durable records, precedence, provenance, and trusted mutation. This issue contributes validated provider/project declarations into that substrate or an effective view over it.
Provider-loaded project declarations and operator-mutated durable state must remain distinguishable by origin/trust class.
#76 / #53
This boundary may expose bounded permission-profile declarations to #76, but does not authorize them. Persistent authorization still requires trusted operator/host grant creation and remains capped by #53/current host policy.
#48 /
rlm_tool_loaderReuse the successful split between sanitized declarative manifests and private trusted loader callables. Do not expose project-provider callables through catalog APIs.
#49/#50
Concrete project/tool integration belongs naturally in downstream libraries/tool packs rather than core.
#52/#72 /
rlm_mcp_policyPreserve separation among MCP server declarations, trusted execution profiles/config references, capabilities, authority, and hard confinement. Project policy may refer to those entities but cannot collapse them.
#16
Project policy/config is trusted/operator configuration, not model-published durable reasoning artifact state.
#68-#71 / especially #70
#70 should be able to inspect effective project instructions/settings as a distinct operator/project configuration provenance class. It must not flatten them into generic repository facts or let resolved context write back trusted policy automatically.
Acceptance criteria
Non-goals
.claude-like filename/directory in core unless neutral discovery evidence later requires one.agentProlog-specific configuration schema in core.consult/1execution path.dangerousor persistentallow_session.Dependencies / references
prolog/rlm_tool_loader.plprolog/rlm_mcp_policy.pldocs/external-tool-libraries.mddocs/mcp-lifecycle.mdresearch/RLM-RESEARCH-003-typed-symbolic-execution.orgresearch/RLM-RESEARCH-009-durable-artifact-context.orgArchitecture clarification from #126/#127: #77 remains the safe core project-policy/provider boundary for declarative/untrusted project configuration. AgentProlog adds a separate downstream trust decision: after the operator explicitly trusts a structured project identity, that project's
.agentprolog/config.prologmay be loaded as executable host extension code. Repository presence alone remains inert. This does not weaken #77's reusable-core rule against arbitrary auto-consult; it distinguishes untrusted discovery from an explicit downstream code-trust grant.