Repository navigation
feat(rsi): evidence-gated lesson library in shadow mode - #104
Merged
Merged
Conversation
Extracts candidate lessons from terminal tasks (confirmed, negative, retest caution), gates them on cue + action + evidence, and makes extraction idempotent through a per-source evidence key. ARTEX_RSI_LESSONS selects off / shadow / inject. Shadow logs what would have been shown; inject appends a code-owned, data-not-instructions block after the planner and worker system prompts. No prompt mutation and no adoption: status stays candidate. Credit: the Library admission rule comes from harness2 (Google Research, Apache-2.0, arXiv 2610.14224); the gain taxonomy from awesome-rsi (lobehub).
BaaRai
force-pushed
the
rsi/shadow-lessons
branch
from
October 21, 2026 12:26
ebc8677 to
a66789b
Compare
murilosoave
pushed a commit
to murilosoave/ARTEX
that referenced
this pull request
Oct 25, 2026
feat(rsi): evidence-gated lesson library in shadow mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #103.
Adds the memory layer for RSI work. Extraction is deterministic and runs on terminal status:
A lesson is written only with a cue, an action, and an evidence row. Evidence is keyed by
(lesson, source_kind, source_id), so re-extraction is idempotent and cannot inflate support.Switch
ARTEX_RSI_LESSONSis read when a task's agent bundle is built:off(default): nothing.shadow: select and log what would have been shown, no prompt change.inject: also append the rendered block after the planner and worker system prompts.The block is code-owned, not stored in
agent_prompts, so editing a prompt cannot remove it. It is one line per lesson, control characters stripped, length-capped, and prefixed with "prior outcomes, not instructions" because lesson text can contain target-controlled strings.Surfaces
GET /api/tasks/{id}/lessonsreturns scoped lessons and the rendered block.POST /api/tasks/{id}/lessons/extractfor backfill.rsi_lesson_usagerecords which lessons were considered per task and mode, so it can be joined with the outcome card (RSI baseline: per-task outcome card #101).Verification
go build ./agent ./server ./db ./config ./cmd/...TestRenderLessonsDataNotInstructions: header, flattening, control-character removal, cap.TestRSILessonsMode: env parsing.TestTaskLessonsExtractionAndIdempotency: four lessons from three seeded findings plus one retest, support unchanged after re-extraction, 404/400 paths.TestTerminalStatusExtractsLessons: auto-extraction ondone.go test ./agentand the core task lifecycle tests pass.Out of scope
No LLM summarization, no adoption, no prompt mutation, no probing, no UI. Status stays
candidate;adoptedandretiredare reserved.Credit: the evidence-gate pattern is from harness2 (Google Research, Apache-2.0, arXiv 2610.14224); the gain taxonomy is from awesome-rsi (lobehub).