[P1] Add skill-aware bounded subagent delegation and reviewer roles #172
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#172
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: #167
Related: #117, #144, #168, #169
Goal
Compose the existing prompt compiler and bounded
rlm_subagentruntime so unresolved work can be delegated to a child with the right selected skill/role context, without inventing another agent runtime.Target flow
Requirements
rlm_subagentandrlm_agentsupervision/cancellation;Acceptance
rlm_subagent;Non-goals
Inspect current merged #144/subagent code and prompt compiler before implementation. Do as much coherent work as possible per cycle.
RAGE cross-connection from #173:
SKILL.mdformat should not own delegation authority/role/model choice. Recognized Claude fields such ascontext,model, oragentmay be preserved as vendor adapter metadata when importing, but they must not directly choose a Prolog subagent, widen capabilities, or become core execution semantics. #172 should keep reviewer/critic/researcher role selection under trusted host/compiler policy and consume selected skill context from #173/#117. No coding in this pass.#172 reconciliation after #203/#204
First skill-aware delegation substrate slice is now landed on
mainas8054606971ffbbb6aa9484b4e915caa4c655929bvia PR #204.What is now canonical:
explicit_skills([...])continues through the childrlm_prompt_compilerrather than a second selector;subagent_role(Role)is bounded inert metadata;subagent_resultcarry selected skill + generic role provenance;rlm_subagentarguments remain query-only and closed;Exact final PR head
c9fbb36003c864884ac6adade5bc0255469cc570passed deterministic CI, REAL OpenRouter, Paid OpenRouter, Nix flake, Tree-sitter FFI, and clean SWI-pack installation before merge.Remaining #172 core gap
The next coherent slice is the actual policy/control flow:
unresolved/unknown need -> prompt compiler/trusted policy selects skill + generic role -> canonical rlm_subagent -> bounded child evidence/result -> parent consumes result and resumes/replansThat slice should reuse the provenance substrate just landed. It must not let skill/role selection widen capability or authority, and failure/denial/cancellation/budget exhaustion must remain structured rather than masquerading as successful delegation.
#175 task deadlines remains separate and should not be folded into that selection/resume slice.
RAGE reconciliation after #206/#207: merged
mainis now36cb418b833c77e24438fa94e596062a90088fa3. The closed KB command path is no longer demo/test host glue:prompt_command_execute/6authenticates the compiled closed command + compiler fingerprint, projects onlyjson{query:Text}, and invokes the canonical typedrlm_subagenttool path. Deterministic coverage proves the real child envelope reaches the parent as canonicalchild_result; forged targets and payload tampering fail before dispatch. Exact candidate head67e8adc43fa3ec134051e2e3f1a05969e4daab8apassed CI (including REAL OpenRouter), Paid OpenRouter, Nix, Tree-sitter, and Clean pack before merge.Remaining #172 gap is now narrower: connect the existing unresolved/unknown policy decision to this compiled-command executor, then make the parent explicitly consume the child result as resume/replan input under the existing global recursion/depth/concurrency/token/time/cancel limits. Do not add another subagent/tool/command path.
RAGE next-slice gate — automatic unresolved delegation + parent resume
Revalidated against canonical
main49d86f88730b4a0f5dc4a7cf300b8f09ef5845b0after #209 and the complete current transaction set. No active PR owns this remaining #172 slice: #212 owns #175 deadlines, #213 owns #211 result projection, #216 owns #176 root-planner tool visibility, and #132 owns #127 configuration.BUG / falsifiable contract
Current merged tests prove the pieces, but not the required control flow.
test/rlm_prompt_command_test.plmanually:unknownKB binding;rlm_subagentfrom the compiled policy;child_resultappears.That proves command authentication, typed dispatch, child context/provenance, and parent mailbox propagation, but it does not prove an unresolved parent decision automatically enters that path or that a successful child result is consumed as resume/replan input. The issue acceptance item is therefore still genuinely open.
The first realization must add the smallest deterministic production-path contract for that missing orchestration. Negative cases must assert the expected structured failure while the suite stays green; do not use intentionally-red CI/xfail/skip as TDD evidence.
Required first matrix:
unknown/unresolveddecision selects an existing compiler-authenticated prompt command and dispatches only throughprompt_command_execute/6+ canonicalrlm_subagent;child_resultbecomes explicit parent continuation/resume input and causes one bounded replan/continue step;Analyze / research
Current source already has the correct reusable boundaries:
rlm_prompt_commandowns closed KB binding compilation, SHA-256 authentication, typedprompt_command_execute/6, andprompt_command_subagent_options/3;rlm_agentalready owns bounded mailboxes, child capability/authority narrowing, supervision, cancellation andchild_resultpropagation;rlm_prompt_compilerremains the only authority for skill/context selection and budgeting.So the remaining defect is orchestration/continuation, not missing delegation primitives.
Downstream evidence agrees with this ownership boundary:
a0-symbolics#51 explicitly leaves symbolic selection/planning/authority/effects/verification in Prolog-RLM, whileagentProlog#8 owns the DeepSeek Harness AgentFactory/product composition. No downstream product code belongs in this slice.Design
Add one generic runtime orchestration boundary that consumes an unresolved/unknown decision as data, resolves the already-closed compiler binding, registers/executes that authenticated command through the existing path, and converts only a successful canonical child result into bounded parent continuation input. The continuation step must reuse the current planner/conversation/runtime contract rather than inventing a second agent loop.
Keep these data classes separate:
unresolved decision -> compiled command -> typed subagent execution -> canonical child_result -> parent continuation/replanActivation/selection remains distinct from capability/authority. Child output/evidence is observation data, never executable Prolog.
Adversarial review
Decision: GO for this narrow slice. Keep #175 deadline work separate and preserve #209 provenance/authentication semantics.
Realization status
No production patch is claimed in this pass. The current execution environment cannot resolve
github.comfor a local checkout, so I cannot safely establish/run the focused deterministic contract or full repository gate before a code write. I am not doing a blind whole-file remote mutation. The next realization should start from this exactmainSHA (or rebase the gate ifmainmoves), add the deterministic green expected-outcome contract first, then implement the smallest orchestration boundary and run the complete exact-head gate.RAGE realization / adversarial / verification update for the remaining parent-resume slice.
Exact start: canonical
main267697bef10a3fffff7c093e1435ece770e7444b.Candidate: PR #238, exact head
9f41aa302a1772272c2d3d8c4d3aefede27cdb48.Realization
Added the generic
rlm_delegation_runtime:delegation_resume/10composition boundary:unresolved trigger -> prompt_command_compile -> authoritative parent capability snapshot -> rlm_subagent_register_command -> prompt_command_execute -> canonical completed child result -> closed resume input -> exactly one trusted continuation.It reuses the existing compiler-authenticated prompt command, typed tool,
rlm_subagent,rlm_agent, authority/effect, budget, cancellation, provenance and trace paths. No second selector/scheduler/executor or downstream product loop was introduced.Adversarial review
The first green candidate accepted a caller-supplied
ParentCapabilitieslist. I rejected that design before promotion because the command-dispatch capability check should not trust glue code to restate parent authority. Currentdelegation_resume/10instead obtains the parent's actual capability set through authoritativeagent_status/3immediately before dispatch.Current failure invariants:
tool(rlm_subagent): structured capability denial, no continuation;rlm_agent/rlm_subagent;Decision: GO for this bounded generic-runtime slice.
Exact-head evidence
9f41aa302a1772272c2d3d8c4d3aefede27cdb48is green on every returned canonical workflow:Public semantics are recorded in
docs/delegation-runtime.md. Negative contracts assert expected failures while CI stays green.PR #238 has no submitted reviews, conversation comments, or unresolved review threads and GitHub reports it mergeable. I am leaving #172 open until the PR lands and the parent acceptance checklist is reconciled against merged evidence.