[P0] Converge skills into prompt compiler and add permanent RLM operator context #451
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#451
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/related: #117, #173, #174, #176, #172
Goal
Make skills a first-class part of the one existing provider-context compiler, then use that machinery to ship a small set of RLM operating skills that are enabled by default and remain present throughout an RLM/agent run unless trusted host configuration disables them.
This is the ADARD decision for the current skills/RLM-context work. No code is part of this issue creation.
Research findings
Agent Skills
The open Agent Skills specification defines
SKILL.mdas portable instructions plus metadata/resources and recommends progressive disclosure: metadata first, full instructions after activation, resources on demand. It providesmetadataas a string->string extension point;allowed-toolsis experimental and must not be treated as authority.The client implementation guide also explicitly recommends protecting activated skill instructions from later context compaction because silently losing skill instructions degrades agent behavior. It allows harness-side/programmatic injection of skill content; model-driven activation is only one possible client strategy.
References:
Recursive Language Models
The RLM paper/runtime treats context interaction and recursive sub-calls as part of the model's operating environment. The authors' reference implementation uses a default system prompt that explicitly teaches the model how to use context,
llm_query/rlm_query, and finalization; it also exposes a custom system-prompt override. Operational RLM instructions therefore must be guaranteed provider-visible runtime context, not merely implicit knowledge.References:
Typed/symbolic RLM research also supports keeping recursion/control flow explicit rather than relying on unconstrained free-form execution:
Prolog constraints
SWI-Prolog CLP(FD) is explicitly intended for declarative integer reasoning and combinatorial problems such as planning, scheduling, and allocation. The agent should recognize those problem classes and prefer an available constraint capability over model guessing.
Reference:
Current repository findings
#173 already freezes the correct architecture
#173 says:
It explicitly rejects a second prompt compiler/skill IR and makes provider visibility and mandatory-context policy host-owned.
PR #122 currently diverges from that decision
PR #122 (
feature/117-prolog-skill-activation) has useful loader/confinement/resource/default-corpus work, but it also implements a separateskill_compile/4selector with its own lexical scoring, thresholds, count/token limits, dependency resolution and fingerprinting, then merges selected skill text intoplanner_instructionthroughrlm_skill_completion.That selection path overlaps the already-landed
rlm_prompt_compiler, which already supportskind:skill, dependencies, conflicts, capabilities, packing, reasons and fingerprints.PR #122 should therefore be reconciled as loader/normalizer + compatibility adapter + package/resource layer, not preserved as a second independent provider-context selector.
At the time of this decision, current
mainis982bad23c59dba0dd9157c1904e7723950889717; PR #122 head is1a34d01dad9020a72a17b9bbae2a698451f575aaand is substantially diverged from current main.#174 has the right generic permanent-visibility primitive
activation:alwaysshould apply to ordinary prompt units, not only tools.mandatory_context:trueremains the post-selection packing invariant. Natural-language negation must not unpin a host-pinned unit. Trusted host disable/narrowing may.#176 is the provider-surface gate
The design is incomplete until the actual provider-bound request is compiled from the prompt compiler. Internal
selected/active_unitsstate is not sufficient evidence that the model received the instructions.Decision
1. One compiler
There is one canonical provider-context selector/packer:
rlm_skillmay own filesystem discovery, standard/vendor parsing, normalization, lazy resources and package security. It must not own a competing routing/scoring/packing engine.2. Permanent context is host policy
An ordinary skill/tool/instruction can be host-pinned:
Meaning:
A
SKILL.mdpackage MUST NOT be able to mark itself permanent/mandatory/trusted. #173 already establishes mandatory/provider policy as host-owned. Standard/vendor activation metadata may disable or influence ordinary automatic activation, but cannot promote itself toalways.3. Default RLM operating skill bundle
Ship a small bundled set of trusted skills, enabled and pinned by the default RLM agent profile:
rlm-operateTeach the actual typed runtime contract: available plan/context/model/tool/RLM operations, bindings/references, finalization, budget awareness, and the rule not to invent unavailable capabilities or context contents.
rlm-recurseTeach useful recursive behavior: inspect context, decompose when useful, use
rlm_subagent/recursive calls for missing or independently investigable work, give children bounded sufficient context, and aggregate returned evidence. Do not teach recursion-for-recursion's-sake.rlm-factsTeach facts/evidence first: query supplied KB/facts/observations before guessing, distinguish retrieved fact from inference, derive with Prolog when deterministic, and use model judgment only where symbolic evidence is insufficient.
rlm-constraintsTeach constraint recognition: for finite-domain, scheduling, allocation, combinatorial or relational arithmetic problems, use an exposed constraint-solver capability when available. Never invent a solver/tool that is absent from the active provider projection.
These should be concise operational skills, not long tutorials.
4. Toggle semantics
Default: core RLM skills are enabled.
Trusted host controls must support:
skill_mode(off)or the reconciled equivalent);No natural-language request or skill-authored metadata can silently disable a host-pinned core skill.
5. Scope of permanence
Every provider request that participates in an RLM/agent run must receive the active permanent units, including recursive/subagent model calls and repair/retry model calls. A low-level standalone raw-LM API may remain raw when invoked outside an RLM/agent execution context; once a model call is part of an RLM run, the run's permanent context propagates with it.
This prevents the root from knowing how to operate RLM while a recursive child silently loses the operating contract.
6. Provider placement
Permanent behavioral skills are skill packages as the source of truth, but the provider renderer should place their active instruction bodies in the provider's durable instruction/system context rather than pretending they are user text. This matches the reference RLM implementation's use of a system prompt for operating instructions.
Provider-specific message/channel mapping remains a renderer concern; skill activation remains provider-neutral.
7. Authority remains separate
A permanent skill/tool is model-visible, not automatically executable.
An always-visible tool still passes existing capability, authority, confinement and effect checks. A skill mentioning a tool does not grant it.
Adversarial review
The implementation must survive at least these cases:
allowed-toolsclaims unavailable authority -> no capability/authority change.SKILL.mdloading remains path-confined and resources remain inert until explicitly read/executed through normal authority boundaries.Required tests
Compiler/loader
prompt_unit{unit:skill(...)};rlm_prompt_compiler;Exact provider-bound proof
Tests must capture the exact request sent to the provider and assert the instruction body/identity is present, not merely inspect compiler state.
Required paths:
Behavioral model tests — no spoon-fed plan
Do not use
planner_instructionto provide the exact plan JSON/steps under test.At least:
Reconciliation requirements
#117 / PR #122
Keep and reconcile the useful package loader, standard/vendor compatibility, resource indexing/confinement, pinned corpus and provenance work. Replace/delegate the independent skill scoring/selection/packing path with normalized prompt-unit registration into
rlm_prompt_compiler, per #173.#174
Treat
activation:alwaysas generic to all prompt units, includingskill(...)andinstruction(...), not a tool-only feature. Host policy owns permanent activation.#176
Extend production provider-surface acceptance to prove permanent skill bodies and instructions reach the exact model request across the RLM run, not just tool schemas at the root planner.
#172
Skill-aware subagent delegation should inherit the parent's permanent skill set by default while still narrowing child capabilities/authority and dynamically selecting additional child-specific relevant skills.
Non-goals
core_skillregistry;Acceptance decision
APPROVED architecture: standard SKILL.md loader -> normalized skill/prompt unit -> single prompt compiler -> host-pinned permanent + dynamically relevant context -> provider-bound request, with a default toggleable RLM operating skill bundle and exact-request tests proving the model actually receives it.
nsaspy referenced this issue2026-09-10 21:20:51 +00:00
Duplicate of #183 (pre-existing Forgejo mirror). Closing this accidental duplicate created by today's open-state sync; #183 stays canonical on Forgejo.