Skip to content

Adaptive Question Tree depth + Q-ID wording fix in Socratic recovery skill#525

Merged
rdmueller merged 1 commit into
LLM-Coding:mainfrom
raifdmueller:fix/socratic-adaptive-depth-qid-522-524
May 21, 2026
Merged

Adaptive Question Tree depth + Q-ID wording fix in Socratic recovery skill#525
rdmueller merged 1 commit into
LLM-Coding:mainfrom
raifdmueller:fix/socratic-adaptive-depth-qid-522-524

Conversation

@raifdmueller

@raifdmueller raifdmueller commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Two fixes to the Socratic Code-Theory Recovery skill, both surfaced by the Mistral Vibe tutorial walkthrough.

#522 — adaptive Question Tree depth. Phase 1 decomposed to a near-fixed depth regardless of bounded-context size, so a large context produced one thin leaf per arc42 chapter and Phase 2 could not synthesize a substantial chapter without inventing detail. Decomposition below the fixed second level is now adaptive: a node is a leaf only when answerable from specific file:line evidence or definitively [OPEN]; a coarse answer (a directory as evidence, one paragraph for a whole chapter) means the node decomposes further — capped at four levels below a fixed node as a runaway-recursion backstop. The fixed skeleton (Q1.1–Q5.5) is unchanged, so trees stay diffable; only depth varies.

#524 — Q-ID wording contradiction. phase-2-synthesize.md opened with "Every claim must be traceable to a Q-ID", contradicting its own traceability rules and output-schema.md (Q-IDs never appear in final documents). Reworded: claims trace back to a tree leaf as a build-time check; output carries file:line evidence and (team answer) markers only.

Changes

  • prompts/phase-1-question-tree.md — adaptive decomposition rule, four-level cap, directory-evidence rejection, new post-prompt depth sanity-check
  • prompts/phase-2-synthesize.md — corrected the Q-ID wording (SKILL.md contradicts phase-2-synthesize.md on whether final docs carry Q-IDs #524)
  • references/output-schema.md — adaptive-depth Q-ID scheme; directory is not valid evidence
  • references/examples.md — the Q3.5 worked example used directory-level evidence (the exact anti-pattern); rewritten as an adaptive parent node with file:line child leaves
  • SKILL.md — adaptive-depth principle in the Phase 1 section
  • contracts.jsonsocratic-code-theory-recovery contract aligned (EN + DE)
  • docs/socratic-recovery-skill.adoc / .de.adoc — website skill page aligned
  • docs/changelog.adoc — 2026-05-21 skill-updates entry
  • plugin skill copies synced via the pre-commit hook

Test plan

  • contracts.json validates as JSON
  • node scripts/render-contracts.js renders without error
  • CI: lint + E2E + Lighthouse

Closes #522
Closes #524

🤖 Generated with Claude Code

Summary by CodeRabbit

Dokumentation

  • Dokumentation
    • Struktur des Socratic Code-Theory Recovery Skills überarbeitet: zweite Baumebene ist nun fix mit stabilen Fragen-IDs (Q1.1–Q5.5)
    • Adaptive Dekomposition erfolgt jetzt ausschließlich unterhalb der festen Ebene mit automatischer Tiefensteuerung nach Code-Dichte
    • Präzisierte Evidenz-Anforderungen: nur konkrete file:line oder file::function-Zitate erlaubt, grobe Evidenzen erfordern weitere Zerlegung
    • Phase-2-Nachverfolgbarkeit angepasst: Behauptungen sind auf Baum-Blätter rückverfolgbar; Q-IDs erscheinen nicht in finalen Dokumenten

Review Change Stack

…ry skill

LLM-Coding#522 — Phase 1 decomposition is now adaptive, not near-fixed. Below the
fixed second level a node is a leaf only when answerable from specific
file:line evidence or definitively [OPEN]; coarse answers decompose
further, capped at four levels below a fixed node. Tree depth tracks code
density, so a large bounded context no longer produces one thin leaf per
arc42 chapter. Directory-level evidence is rejected as a too-shallow
signal. A post-prompt depth sanity-check and a corrected Q3.5 worked
example demonstrate the pattern.

LLM-Coding#524 — the Phase 2 prompt said "every claim must be traceable to a Q-ID",
contradicting the schema (Q-IDs never appear in final documents). Reworded
to match: claims trace back to a tree leaf as a build-time check; the
output carries file:line evidence and (team answer) markers only.

Touches the skill prompts/references, the socratic-code-theory-recovery
contract, and the website skill page for consistency.

Closes LLM-Coding#522, LLM-Coding#524

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Der Pull Request präzisiert die Socratic Code-Theory Recovery-Methode: Phase-1-Decomposition wird adaptiv (Blätter entstehen nur mit konkreter file:line-Evidenz oder explizitem [OPEN]), während die feste zweite Ebene (Q1.1–Q5.5) für Diffbarkeit bestehen bleibt. Tree-Tiefe folgt Code-Dichte unter einem 4-Level-Backstop. Phase-2-Traceability verknüpft Claims mit Tree-Leaves statt Q-IDs, die nicht in Finaldokumenten erscheinen. Alle Prompts, Beispiele und Verträge werden entsprechend aktualisiert.

Changes

Adaptive Question Tree mit Fixed Second Level

Layer / File(s) Summary
Skill-Definition und Grundkonzept
docs/changelog.adoc, docs/socratic-recovery-skill.adoc, docs/socratic-recovery-skill.de.adoc, skill/socratic-code-theory-recovery/SKILL.md, plugins/semantic-anchors/skills/socratic-code-theory-recovery/SKILL.md
Phase-1-Methode wird neu definiert: adaptive, code-getriebene Zerlegung nur unterhalb der festen zweiten Ebene (Q1.1–Q5.5), Blatt-Kriterium ist konkrete file:line-Evidenz oder explizites [OPEN], Tiefe orientiert sich an Code-Dichte mit 4-Level-Backstop, Q-IDs auf festen Knoten bleiben stabil und diffbar.
Phase-1-Dekomposition: Blatt-Kriterien und Tiefenkontrolle
skill/socratic-code-theory-recovery/prompts/phase-1-question-tree.md, plugins/semantic-anchors/skills/socratic-code-theory-recovery/prompts/phase-1-question-tree.md
Detaillierte Phase-1-Regeln für Leaf-Bildung: konkrete file:line/file::function-Evidenz erforderlich oder explizit [OPEN], grobe Evidenz (Verzeichnisse, ganze Dateien) erzwingt weitere Zerlegung, 4-Level-Backstop verhindert Runaway-Rekursion, Post-Prompt-Checks validieren Granularität und Tiefe.
Phase 2: Traceability auf Tree-Leaves und Evidence-Schema
skill/socratic-code-theory-recovery/prompts/phase-2-synthesize.md, plugins/semantic-anchors/skills/socratic-code-theory-recovery/prompts/phase-2-synthesize.md, skill/socratic-code-theory-recovery/references/output-schema.md, plugins/semantic-anchors/skills/socratic-code-theory-recovery/references/output-schema.md
Phase-2-Traceability wechselt von Q-ID-Bezug zu Tree-Leaf-Bezug (Build-Time-Check), Q-IDs dürfen nicht in finalen Dokumenten erscheinen, Evidence-Regeln präzisiert: file:line und file::function erlaubt, file nur für echte File-Scope-Claims, Verzeichnis-Evidenz ungültig.
Referenzbeispiele: Q3.5 als Parent-Node mit Leaf-Children
skill/socratic-code-theory-recovery/references/examples.md, plugins/semantic-anchors/skills/socratic-code-theory-recovery/references/examples.md
Q3.5 wird von grober [ANSWERED]-Leaf zu Parent-Node umstrukturiert; Module (Q3.5.1 api, Q3.5.4 persistence) werden als [ANSWERED]-Leaves mit file:line-Evidenz ausgearbeitet, restliche Module folgen gleichem Muster, Dependency-Richtung als separater Leaf unter Q3.9.
Contract-Template und Language Variants
website/public/data/contracts.json
Website-Vertrag für socratic-code-theory-recovery aktualisiert: präzisiert feste Q-Knotenliste (Q1.1–Q5.5 inkl. arc42-Bereiche), verlagert adaptive Zerlegung unter diese Ebene, neuer Leaf-Abbruchkriterien-Text mit 4-Level-Cap und Evidence-Anforderungen, deutsche Variante synchronisiert.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • LLM-Coding/Semantic-Anchors#485: Aktualisiert ebenfalls das socratic-code-theory-recovery-Contract-Template in contracts.json mit adaptiver Decomposition und Four-Level-Cap-Regeln.
  • LLM-Coding/Semantic-Anchors#478: Modifiziert die gleichen Phase-1/Phase-2-Prompts und Evidence-Constraints in phase-1-question-tree.md und phase-2-synthesize.md.
  • LLM-Coding/Semantic-Anchors#497: Ändert die Phase-1-Decomposition und fixed-second-level-Scheme (Q1.1–Q5.5) in denselben Prompt- und Skill-Dokumentationsdateien.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Der Titel beschreibt die zwei Hauptänderungen des PR: adaptive Baum-Tiefe und Q-ID-Wording-Korrektur, was den Inhalten der Änderungen entspricht.
Linked Issues check ✅ Passed Der PR adressiert beide verlinkten Issues (#522, #524) vollständig: adaptive Question-Tree-Tiefe mit Evidenz-Regeln und Q-ID-Dokumentationsanpassung.
Out of Scope Changes check ✅ Passed Alle Änderungen betreffen die Dokumentation und Prompts des Socratic-Recovery-Skills und sind direkt auf die beiden verlinkten Issues (#522, #524) bezogen.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants