| name | sl-learn |
| description | Compatibility learning seam for the legacy lfg pipeline: invoke sl-compound headless, evaluate the result, commit an accepted docs/solutions learning into the open PR, and re-confirm CI. Use only when legacy lfg invokes ship-time learning; new sl-run workflows use their typed evidence closeout instead. |
| argument-hint | [brief context hint about what the run solved] |
Learn Seam
This remains a compatibility capability for legacy lfg. Do not invoke it from the streamlined sl-run workflow: sl-run builds a durable closeout packet, treats no-learning as normal, and records the result through its kernel without depending on hot transcript context.
Capture what an autopilot run learned, into the run's PR, while the solving context is still hot — then leave the loop's verifiable-green stop intact.
What this seam is for
The autopilot consumes learnings (planning and review read docs/solutions/) but otherwise produces none: when an unattended loop.sh run solves a non-trivial problem and exits at DONE, no human is present to run /sl-compound, so the learning evaporates. This seam closes that gap. It runs in the same process as the solving session — never a fresh claude -p — because the hot context is exactly what sl-compound needs; a fresh process would see only the diff.
sl-compound makes the authoritative keep/skip decision (its own preconditions). This seam supplies a permissive signal that a qualifying problem plausibly occurred, invokes sl-compound, and disposes of its output.
Before committing, the seam gates the drafted learning through an independent, fresh-context evaluator (sl-learning-evaluator). The generator that wrote the learning — the same hot context that did the work — is not trusted to grade it, so a separate agent weighs an evidence packet and returns a three-state verdict: verified, candidate, or rejected. The verdict decides whether the learning is committed and with what confidence label. Only an affirmative rejected blocks the commit; an unconfirmed-but-uncontradicted learning still commits, labeled candidate.
Steps
-
Gate. Decide whether to proceed at all, in this order:
-
No open PR → skip the whole seam and return. Capture is defined as a commit into the run's PR; with no PR there is no sink (a fallback is out of scope). Detect with:
gh pr view --json number,state,body
If this errors or reports no open PR, return without doing anything.
-
Step 9 ended red → do not fire. When lfg forwards a progress:<path> marker (a headless loop.sh run), read the recorded step-9 ci_disposition from that file — that recorded disposition is the machine gate: a non-green value (e.g. unresolved) means the run's problem was not solved (sl-compound's solution_verified precondition is unmet by definition), so return without firing. With no progress marker (interactive invocation), fall back to the documented signal: the PR body carrying a ## CI Failures Unresolved section. Firing on a known-red PR would only commit a no-op. The ## CI Failures Unresolved PR section is the human-facing record, not the machine gate.
-
Otherwise, judge whether a non-trivial problem plausibly occurred from in-session signals: a fix(ci): commit on the branch since its base (CI went red→green in step 9), review-fix commits from step 5, or the agent's own read of a debugging detour solved during the work phase (the only signal when CI never failed). Err toward proceeding when unsure — stage 1 is deliberately permissive; sl-compound's precondition gate is the authoritative backstop. Only when nothing noteworthy was solved (a plain feature ship), skip without invoking sl-compound.
-
Invoke sl-compound headless. Load the sl-compound skill via the Skill tool, in this same process, with the mode:headless token and a brief one-line context hint about what the run solved. The token makes it run non-interactively; its preconditions are the keep/skip authority (stage 2).
-
Read the terminal report. sl-compound ends with one of two sentinels:
Documentation skipped → return without committing. The PR stays exactly as it was.
Constraints
- Stage only the report's named paths. A blanket
git add -A sweeps unrelated working-tree residue from earlier lfg steps into the learn commit; a learning-only commit leaves the CONCEPTS.md and instruction-file edits uncommitted, so they never reach the PR — silently degrading capture to learning-only when R5 wants all of sl-compound's outputs in the PR, not just the learning.
- Same process only. Invoke
sl-compound via the in-session Skill tool, never a fresh claude -p. The hot solving context is the input it needs.
- Always re-confirm green; never special-case docs-only. The seam cannot know the target's CI
paths/paths-ignore config, so it cannot assume a docs-only commit skips CI. Re-confirm every time.
- This seam writes into the repo and commits — that is the one way it diverges from
sl-handoff's read-only shape. It signals refresh-due (step 8) but never dispatches sl-compound-refresh: the refresh is a maintenance pass that consolidates and deletes docs, so it stays a human-approved action, never an autonomous one triggered from an unattended loop.