Skip to content

Commit e6a8937

Browse files
committed
feat(agent-workspace): enforce rag profile completeness
1 parent 14047bb commit e6a8937

7 files changed

Lines changed: 515 additions & 35 deletions

docs/diataxis/en/explanation/development-progress-dashboard.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ It tracks what is already implemented, where the hard gaps remain, and how to ve
55

66
## 2026-07-05 RSE Document-Augmented Graph RAG Implementation Plan
77

8-
This slice now tracks implementation progress for richer Knowledge Workspace answers. The concrete plan remains at [RSE document-augmented graph RAG answer pipeline](../../../plans/2026-07-05-001-feat-rse-document-augmented-rag-plan.md), but the branch has moved beyond planning: the deterministic RSE/document-augmentation path, full-document graph-neighbor augmentation, query-intent graph-neighbor ranking, intent-aware graph connection-path ordering, intent-aligned graph-window ambiguity filtering, budgeted context pack, stable RAG context replay ids, provider-backed sufficiency trace, bounded one-step recovery, RAG failure-stage classification, RAG-aware one-message release review, claim-level citation-backed RAG release gating, prompt/preamble artifact filtering for public RAG clauses, answer claim-to-citation trace/export mapping, operand-aware compare answer-profile budgeting, how-to answer-profile budgeting, causal answer-profile budgeting, generic answer-profile ranking, Mermaid-label evidence extraction, source-label stripping for public RAG clauses, runtime verifier fields, graph successor-window and graph-diagnostics verifier assertions, context-budget truncation/drop/malformed-provider/timeout-provider/graphintent probe coverage, conflicting adjacent, same-section non-adjacent, cross-document structured measurement/date/location/quantity evidence including plural unitless quantity facts, same-document and cross-document controlled ownership identity conflicts, controlled endpoint/dependency/semantic-version/service-port/response-status-code conflicts, full-document remote-scan hard-negative coverage, controlled current-vs-historical, environment-qualified, version-qualified, and platform-qualified false-positive guards including condition-scoped ownership identity plus cross-document condition-scoped endpoint/format/protocol interface facts, dependency facts, semantic-version facts, service-port facts, and response-status-code facts, scoped graph-neighbor RAG evidence filtering, single- and multi-neighbor graph source-unavailable hard-negative coverage, localized frontend RAG status, and export RAG trace preservation are implemented. Calibrated graph-confidence thresholds, broader replay tooling over larger corpora, deeper synthesis beyond deterministic source-label stripping, further profile-specific release-budget calibration, broader semantic conflict classes, and larger runtime probes remain follow-up work.
8+
This slice now tracks implementation progress for richer Knowledge Workspace answers. The concrete plan remains at [RSE document-augmented graph RAG answer pipeline](../../../plans/2026-07-05-001-feat-rse-document-augmented-rag-plan.md), but the branch has moved beyond planning: the deterministic RSE/document-augmentation path, full-document graph-neighbor augmentation, query-intent graph-neighbor ranking, intent-aware graph connection-path ordering, intent-aligned graph-window ambiguity filtering, budgeted context pack, stable RAG context replay ids, provider-backed sufficiency trace, bounded one-step recovery, RAG failure-stage classification, RAG-aware one-message release review, claim-level citation-backed RAG release gating, prompt/preamble artifact filtering for public RAG clauses, answer claim-to-citation trace/export mapping, operand-aware compare answer-profile budgeting, how-to answer-profile budgeting, causal answer-profile budgeting, generic answer-profile ranking, profile-specific release-completeness signals for how-to and causal answers, Mermaid-label evidence extraction, source-label stripping for public RAG clauses, runtime verifier fields, graph successor-window and graph-diagnostics verifier assertions, context-budget truncation/drop/malformed-provider/timeout-provider/graphintent probe coverage, conflicting adjacent, same-section non-adjacent, cross-document structured measurement/date/location/quantity evidence including plural unitless quantity facts, same-document and cross-document controlled ownership identity conflicts, controlled endpoint/dependency/semantic-version/service-port/response-status-code conflicts, full-document remote-scan hard-negative coverage, controlled current-vs-historical, environment-qualified, version-qualified, and platform-qualified false-positive guards including condition-scoped ownership identity plus cross-document condition-scoped endpoint/format/protocol interface facts, dependency facts, semantic-version facts, service-port facts, and response-status-code facts, scoped graph-neighbor RAG evidence filtering, single- and multi-neighbor graph source-unavailable hard-negative coverage, localized frontend RAG status, and export RAG trace preservation are implemented. Calibrated graph-confidence thresholds, broader replay tooling over larger corpora, deeper synthesis beyond deterministic source-label stripping, further profile/corpus-specific release-budget calibration, broader semantic conflict classes, and larger runtime probes remain follow-up work.
99

1010
Current code-vs-plan reading:
1111

@@ -14,7 +14,7 @@ Current code-vs-plan reading:
1414
| RSE should start from precise hit spans rather than broad documents | `src/learning/queryBackend.ts` and `src/learning/KnowledgeLearningPlatform.ts` already return evidence spans, citations, relation paths, query variants, and scoped recovery trace data. `src/learning/evidenceContextAssembler.ts` now starts from those spans instead of whole-document dumping. | Implemented deterministic path |
1515
| Document augmentation should recover enough surrounding source context to answer fully | `evidenceContextAssembler.ts` now reads the full selected source document through a platform boundary, preserves direct support, adds parent/adjacent context, dedupes overlapping windows, emits full-document-aware graph-neighbor support fragments, and marks `source_window_unavailable` when it cannot recover source text. | Implemented deterministic path |
1616
| Graph context should use in-degree/out-degree and neighbor content, not only neighbor titles | `KnowledgeLearningPlatform.agentConversation()` now materializes selected graph-neighbor items and lets the evidence assembler produce both snippet-level and full-document-aware `graph_neighbor_support` fragments. `graphContextAssembler.ts` now ranks predecessor/successor windows and connection paths with query-intent scoring policies, relation-kind priority, confidence/provenance scoring, anchor-equivalent filtering, bibliography exclusion, and intent-aligned ambiguity filtering before evidence assembly. Compare windows prefer `contrast` / `analogy` neighbors when present, fail open to structural neighbors only when no aligned candidate exists, and expose aligned/misaligned candidate diagnostics. | Implemented deterministic path; larger-corpus calibration remains |
17-
| The answer should be one visible message while orchestration stays in backend | `conversationComposer.ts` now passes `ragContextPack` and `ragSufficiencyReview` into `answerReleaseReview.ts`; release review can revise or enrich a public answer from direct, document, and graph fragments while keeping orchestration in trace/status surfaces, and `rag_claim_citation_support` now contracts drafts when sentence-level public claims are unsupported or only weakly covered by citation-backed RAG fragments. Compare-intent RAG answers now extract operands, keep explicit scope from being hard-narrowed to only title-hit document ids, reserve four direct-support clauses for both sides, rank evidence by operand/fragment coverage, and turn Mermaid comparison labels into readable evidence before graph contrast context is added. How-to answers now reserve direct/document/graph budget for ordered steps, prerequisites, downstream checks, and failure handling instead of collapsing to a generic overview. Generic answers now use query-term coverage ranking and two direct-support slots so broad prompts keep the most relevant grounded clauses instead of generic preambles. `ragPublicText.ts` now strips source-authored labels such as `Prerequisite:`, `Mechanism:`, `Graph caveat:`, and `Failure mode:` from the public answer while preserving `Step 1:`-style step numbers and the original trace fragments. `KnowledgeLearningPlatform.ts` now records optional `answerClaimCitations` that map public-answer claims to citation ids, RAG fragment ids, and source paths for trace/export auditing, while `agent_workspace.js` / `workspace_panes.js` show compact status rather than extra chat messages. | Preserved and strengthened |
17+
| The answer should be one visible message while orchestration stays in backend | `conversationComposer.ts` now passes `ragContextPack` and `ragSufficiencyReview` into `answerReleaseReview.ts`; release review can revise or enrich a public answer from direct, document, and graph fragments while keeping orchestration in trace/status surfaces, and `rag_claim_citation_support` now contracts drafts when sentence-level public claims are unsupported or only weakly covered by citation-backed RAG fragments. Compare-intent RAG answers now extract operands, keep explicit scope from being hard-narrowed to only title-hit document ids, let the initial draft keep multiple direct-support clauses for both sides, rank evidence by operand/fragment coverage, filter procedure-like evidence from public compare answers unless the query itself is procedural, and turn Mermaid comparison labels into readable evidence before graph contrast context is added. How-to answers now reserve direct/document/graph budget for ordered steps, prerequisites, downstream checks, and failure handling instead of collapsing to a generic overview. Generic answers now use query-term coverage ranking and two direct-support slots so broad prompts keep the most relevant grounded clauses instead of generic preambles. `ragPublicText.ts` strips source-authored labels such as `Prerequisite:`, `Mechanism:`, `Graph caveat:`, and `Failure mode:` from the public answer while preserving `Step 1:`-style step numbers and the original trace fragments. `answerReleaseReview.ts` now extends `rag_answer_completeness` with how-to and causal profile signals, so drafts that omit pack-backed prerequisites, failure handling, mechanisms, consequences, or boundaries are revised through profile-aware direct/document/graph clause budgets. `KnowledgeLearningPlatform.ts` now records optional `answerClaimCitations` that map public-answer claims to citation ids, RAG fragment ids, and source paths for trace/export auditing, while `agent_workspace.js` / `workspace_panes.js` show compact status rather than extra chat messages. | Preserved and strengthened |
1818
| LLM judging should improve answer completeness | `ragSufficiencyJudge.ts` has deterministic gates plus an injected optional LLM judge hook. `ragSufficiencyProviderJudge.ts` now adapts the existing `LlmProviderClient` / NoteMD settings boundary with strict JSON parsing, timeout, no retries, and deterministic fallback through the reviewer catch path; malformed completion text now rejects at the adapter boundary so `llm_judge_failed:*` remains replayable. `KnowledgeLearningPlatform.agentConversation()` now performs at most one bounded recovery assembly/review pass when the first pack is recoverably borderline or insufficient. | Implemented for Unit 5 |
1919
| Weak evidence should degrade explicitly | `RagSufficiencyReview` now records `sufficient`, `borderline`, or `insufficient` plus degradation states such as `partial_coverage`, `conflict`, and `insufficient_evidence`; `evidenceContextAssembler.ts` now emits a `conflict` fragment for same-subject measurement, unitless quantity/limit, date/year, explicit state/status, controlled location, controlled ownership identity, controlled endpoint, controlled dependency, controlled semantic-version, controlled service-port, or controlled response-status-code evidence with divergent values when those facts are adjacent or non-adjacent inside the same scoped section. `KnowledgeLearningPlatform.ts` now filters RAG graph-neighbor items against the resolved conversation scope before evidence assembly, so scope-external graph neighbors cannot inject conflict evidence or force false `partial_coverage` degradation. In-scope graph-neighbor source-window misses still retain graph-neighbor role provenance, and `ragSufficiencyJudge.ts` degrades graph context when the neighbor has only a direct span but no recoverable source window. `KnowledgeLearningPlatform.ts` classifies the resulting states under `context_assembly` or `graph_evidence` as appropriate. The frontend evidence pane displays the compact state. | Implemented for deterministic review; broader semantic classes remain open |
2020

@@ -43,6 +43,7 @@ Fresh implementation evidence in this slice:
4343
- `src/learning/answerReleaseReview.ts` now enforces `rag_claim_citation_support`, so sentence-level public RAG claims must be supported by citation-backed fragments before release; unsupported or weakly covered claims trigger the existing RAG-grounded revision path.
4444
- `src/learning/answerReleaseReview.ts` now filters prompt/preamble artifacts such as "all reasoning" or "final output language" from RAG-grounded public clause selection before revision.
4545
- `src/learning/ragPublicText.ts` now centralizes public RAG source-label stripping for both composer drafts and release-review revisions, keeping source-authored labels out of the one visible answer while leaving raw fragments available in trace/artifacts.
46+
- `src/learning/answerReleaseReview.ts` now adds profile-specific completeness signals to the existing `rag_answer_completeness` gate for how-to and causal answers; missing prerequisites/failure handling or downstream consequence evidence triggers a RAG-grounded revision using profile-aware evidence budgets.
4647
- The compact and spaced `waterglass` runtime probes now require failed release gates to include both `query_intent_alignment` and `rag_claim_citation_support`, and they reject prompt/preamble artifacts such as `所有推理过程`, `最终输出`, `遵从您的指示`, `all reasoning`, and `final output` from the public answer.
4748
- `src/learning/graphContextAssembler.ts` now applies intent-specific graph-window and connection-path scoring: compare queries can prefer contrast/analogy neighbors over procedural sequence/application paths even when the procedural edge has higher confidence, while definition and how-to queries keep their own structural priorities.
4849
- `src/learning/KnowledgeLearningPlatform.ts` now recognizes compare operands across `compare X and/with/to Y`, `X vs Y`, `difference between X and Y`, and `X differs from Y` patterns without constraining an explicit scope to title-hit document ids only.

0 commit comments

Comments
 (0)