feat(context): purify leading SYSTEM, route context layers as USER turns (#290)

Move intent, repo map, docs catalog, decision journal and relevant-files
context entries to EntryRole.USER so they no longer fold into the single
leading SYSTEM block — that block stays pure policy/schema. Omit L3 repo-map
retrieval on repair retries (the transcript already carries the evidence).
Add "initialIntent" to REQUIRED_SOURCE_TYPES.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 18:35:29 +04:00
parent bc050f8e8a
commit 3bf4dd7379
7 changed files with 57 additions and 13 deletions
@@ -233,14 +233,14 @@ class ContextFeedbackTest {
}
@Test
fun `buildRelevantFilesEntry produces L3 system entry with Relevant files header`() {
fun `buildRelevantFilesEntry produces L3 user entry with Relevant files header`() {
val hits = listOf(
RepoKnowledgeHit(path = "src/Parser.kt", text = "src/Parser.kt: Parser, Lexer", score = 0.9f),
RepoKnowledgeHit(path = "src/Main.kt", text = "src/Main.kt: main", score = 0.7f),
)
val entry = buildRelevantFilesEntry(hits)
assertEquals(ContextLayer.L3, entry.layer)
assertEquals(EntryRole.SYSTEM, entry.role)
assertEquals(EntryRole.USER, entry.role)
assertEquals("relevantFiles", entry.sourceType)
assertTrue(entry.content.startsWith("## Relevant files"), "content: ${entry.content}")
assertTrue(entry.content.contains("src/Parser.kt"), "content: ${entry.content}")