Manuscript Offprint
arXiv:2611.01042Constraint Dependency Graph Retrieval for Compliance Detection on Long SKILL Documents
Shuaitao Zhao*
Meituan
Beijing, China
Yuchen Wei
Zhejiang University
Hangzhou, China
Fei Han
Meituan
Beijing, China
Feng Ni*
Meituan
Beijing, China
Shuaike Li
University of Science and Technology
of China
Hefei, China
Yang Wei
Meituan
Beijing, China
Lichao Ma
Peking University
Beijing, China
Jiaye Lin
Meituan
Beijing, China
Lu Pan
Meituan
Beijing, China
Abstract
Large Language Model (LLM) agents carry out business operations under enterprise documents we refer to as SKILL documents, which take the form of standard operating procedures (SOPs) that state the conditions to verify and the actions to take before an operation proceeds. Long, densely cross-referenced SKILL documents exceed the context budget of small deployed auditors. Similarity-based retrieval then brings in irrelevant rules while omitting mandatory prerequisites, and the two-stage audit policy provides no trainable signal for the retrieval stage. We present SkillCDG, a compliance detection framework that reformulates each SKILL document as a constraint dependency graph, shifting rule retrieval from similarity-based matching to closure-based selection under the deployment's context budget. Each atomic rule is anchored to its source text span as a graph node, and mandatory prerequisite relations form the sole edge type. Policy-generated retrieval keywords activate seed rules, whose dependency closure yields a compact and conditionally complete rule context within that budget. The same graph also supports a joint optimization scheme. The retrieval stage is trained with group-relative policy optimization using a verifiable reward that combines output-format validity with downstream verdict correctness, with closure non-emptiness serving as a validity gate, while selective on-policy distillation concentrates teacher supervision on high-entropy reasoning tokens, with verdict and termination tokens always included, to improve verdict accuracy. Experiments on three enterprise datasets and two public benchmarks show that SkillCDG improves accuracy and F1 over the full-document and retrieval-based baselines.
*Equal contribution.
CCS Concepts
• Applied computing → Enterprise computing; • Information systems → Information retrieval.
ACM Reference Format:
Shuaitao Zhao, Feng Ni, Lichao Ma, Yuchen Wei, Shuaike Li, Jiaye Lin, Fei Han, Yang Wei, and Lu Pan. 2027. Constraint Dependency Graph Retrieval for Compliance Detection on Long SKILL Documents. In . ACM, New York, NY, USA, 12 pages.
1 Introduction
LLM agents increasingly carry out business actions under written enterprise policies, which we refer to as SKILL documents and which state the conditions to verify and the actions to take before an operation proceeds [3, 4, 22, 33]. Because such a document is a specification rather than a preference, the same visible action can arise from a procedure that was followed and from one that was not, and in domains such as billing, refunds and access control this difference persists even when the outcome itself looks correct, as Figure 1 illustrates. This makes the document an object of audit as well as a guide, and it defines the task we study here, compliance detection, which is to take an interaction together with the response that followed it and produce a verdict, identifying the violated rule and its source span whenever the verdict is non-compliant. Recent work treats this task as a distinct target, and CompliBench provides an explicit benchmark for it [20, 31, 32].
The difficulty begins with scale, since enterprise policies grow as the business grows and a single document can exceed ten thousand tokens [18]. Rules inside such a document also refer to one another, so the rules that govern one scenario are rarely self-contained and are assembled from several places in the text. The natural response is to place the whole document in the auditor's context, yet a small deployed auditor has room for only a fraction of it, and that fraction is spent largely on rules the current scenario does not activate. A more economical response is to retrieve the rules that appear
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.
Conference'17, Washington, DC, USA
© 2027 Copyright held by the owner/author(s). Publication rights licensed to ACM.
relevant, and much of the recent progress in retrieval has taken this form [17], which shifts the burden from reading to locating, since the auditor is now responsible for finding the governing rules before judging anything. That direction has produced real gains, and it was our starting point, which raises the question of whether relevance is the target worth pursuing.
A verdict depends on the set of rules that are jointly required, and not on the set of rules that read as similar to the scenario. When one rule requires another to be judged first, retrieving the first without the second leaves the verdict unsupported even though the retrieved rule is plainly relevant, and in the other direction a prerequisite may be phrased in words that the scenario does not use, so no degree of similarity will surface it. Similarity therefore answers a question that is close to, but not the same as, the one the verdict poses, and this is the first of the two gaps we address. Recent work has moved in a related direction by selecting passage sets that satisfy a query as a whole [16] and by showing that coverage-based retrieval metrics correlate more strongly with downstream RAG information coverage than relevance-based metrics [25], while graph-based retrieval has improved multi-hop access by following semantic relations [6, 9, 10]. These approaches either optimize a retrieval score or measure evidence use after retrieval. Neither certifies that no prerequisite was omitted, and a longer context window is no substitute, since dispersed evidence is often left unused even when it is present [5, 19] and compression risks discarding the one prerequisite that changes the verdict [12, 21].

Figure 1: Identical responses may result from compliant and non-compliant procedures. Reliable auditing requires the applicable rule and its complete set of policy prerequisites.
Auditing is not a single decision either, since it proceeds in two steps, the first selecting the rules to be read and the second reaching a verdict. The retrieval stage produces keywords rather than an answer and leaves no record of which rules should have been selected, so a correct verdict does not show that the right rules were retrieved and an incorrect one does not show which of the two stages went astray. Group-relative policy optimization offers a way to train the retrieval stage without a separate value model [28], and related work has used outcome reward to shape an intermediate search decision [13, 36], yet two problems remain. When all samples in a group receive the same reward, the relative advantage is zero and no update follows [11, 35], and where finer credit is wanted, existing agents rely on repeated environment states or on annotated evidence [7], and the retrieval stage provides neither form of retrieval-level supervision. A teacher can supply
the missing signal, yet on-policy distillation applied across every token is costly [1, 8] and a small share of tokens appears to decide an outcome [29].
This paper presents SkillCDG, which compiles each SKILL document into a constraint dependency graph and audits against the graph rather than against the raw document. Each node is a single atomic rule recorded together with the span of the source document it came from, and the graph carries one kind of edge, written require, which holds between two rules when the second is required to be judged before the first. At inference the scenario activates a small set of seed rules, and the rules that are read are those seeds together with everything reachable from them along require edges, so the resulting set is small, conditionally complete with respect to the activated seeds and the extracted require edges, and traceable rule by rule to the original text. The same graph also supplies the non-emptiness half of the validity check: a selection is valid when it parses and reaches at least one rule, and non-emptiness needs no retrieval-level labels, learned reward model, or separate value model. On that basis the two steps are trained together. The retrieval stage is trained by group-relative policy optimization with a verifiable reward that combines output-format validity with downstream verdict correctness, and the judgment stage is sharpened by an on-policy distillation in which the teacher scores the student's own tokens rather than generating its own, with supervision concentrated on the highest-entropy reasoning tokens, while verdict and termination tokens are always included.
We evaluate SkillCDG on three enterprise datasets and two public benchmarks. Accuracy (ACC) improves over the full-document and retrieval-based baselines, and F1 also rises. Most of the gain over frozen-retrieval baselines comes from training the retrieval stage, while the closure itself is the largest single contributor. An ablation that removes the dependency closure, freezes retrieval, removes the entropy gate, and removes the teacher separates the contribution of each component.
This work makes three contributions. (1) We compile each SKILL document into a constraint dependency graph whose nodes are atomic rules anchored to spans of the source text and whose only edge, require, marks a mandatory prerequisite, and we use the dependency closure of scenario-activated seed rules as the judgment context, which is tight, conditionally complete with respect to the activated seeds and the extracted require edges, and traceable to the original text. (2) We treat the retrieval stage and the judgment stage as two stages of one policy and train them jointly, training the retrieval stage by group-relative policy optimization with a verifiable reward that combines output-format validity with downstream verdict correctness, with closure non-emptiness serving as a validity gate, and relying on no retrieval-level labels, no reward model and no critic. Within the same optimization the judgment stage is sharpened by an entropy-gated selective on-policy distillation in which the teacher scores rather than generates, so that supervision is concentrated on the highest-entropy reasoning tokens, with verdict and termination tokens always included. (3) We validate the method on three enterprise datasets and two public benchmarks, and it improves accuracy and F1.
2 Related Work
2.1 Retrieval-Augmented Generation
Retrieval-augmented generation supplements a language model's parametric knowledge with evidence retrieved at inference time [17]. The original framework retrieves passages by dense similarity [15] and prepends them to the prompt, making similarity the default retrieval objective for this line of work. Subsequent research refines retrieval along this axis: Lee et al. [16] shifts from ranking to set selection to better cover multi-facet queries, while Samuel et al. [25] shows that coverage-based retrieval metrics correlate more strongly with downstream RAG information coverage than relevance-based metrics. Work on the consumption side finds that long contexts do not guarantee faithful use of retrieved evidence [2, 5, 19], which motivates prompt-compression methods [12, 21] that trim by information density. Graph-based methods restructure the corpus before retrieval: GraphRAG [6] builds a knowledge graph from the corpus and aggregates community-level summaries for query-focused tasks, while LightRAG [9] and HippoRAG [10] add lightweight graph indices or biologically inspired associations for cheaper graph-level access. These methods move retrieval from passages to graph structures, but the edges remain semantic associations and the retrieval objective stays relevance-maximizing. They do not model mandatory prerequisites between rules or compute a closure over them, so they do not provide the completeness guarantee that compliance reasoning requires. Our work adopts the graph representation but replaces the edge semantics with a single mandatory-dependency type and the retrieval objective with dependency closure solving.
2.2 Instruction Following and Compliance Detection
Instruction-following evaluation in chat settings is established by Zhou et al. [37]. Earlier work studied learning from human feedback as a way to align model outputs with stated preferences [38]. In enterprise settings, evaluation has shifted toward agentic and policy-bound tasks: AgentIF [22] benchmarks instruction following across real agentic applications with long and multi-constraint instructions, GuideBench [4] evaluates domain-oriented guideline adherence, and r-bench [33] and its dual-control extension [3] supply interactive tool-agent-user environments. Tool-augmented agents [26, 34] and chain-of-thought prompting [30] broaden the range of tasks and reasoning traces that such evaluations must cover. These benchmarks measure end-to-end compliance but keep retrieval, dependency resolution, and verdict production inside the model, so a failure is not attributed to a specific stage. Recent work begins to isolate the compliance check from the agent under audit: Liu et al. [18] studies how agents internalize complex policy documents, PolicyGuard [31] learns efficient guardrails for compliance, PolicyGuide [14] extends policy compliance to full workflow guidance, PROBE [20] trains an auditor agent to verify tool-using agents against policy, and CompliBench [32] benchmarks LLM-as-judge for violation detection and localization in multi-turn dialogues. Rachmil et al. [23] take a training-free approach and detect policy violations by comparing hidden activation norms against in-policy statistics. Most of these works take the policy document as given
and leave rule selection to the judge. PolicyGuide is the exception: it compiles the policy into a workflow graph and verifies at user-turn boundaries. Our work makes rule selection explicit: the constraint dependency graph turns the applicable-rule set into a checkable artifact, and the closure property makes completeness a stated property of the input rather than an assumption about the model.
2.3 Reinforcement Learning and On-Policy Distillation
Group Relative Policy Optimization (GRPO) [28] trains language models with outcome-level rewards by normalizing advantages within a sampled group, removing the value network required by PPO-style methods [27]. Follow-up work studies its failure modes and extensions: advantage collapse [11] diagnoses and mitigates gradient degradation when group rewards are uniform, Group-in-Group policy optimization [7] extends the grouping structure to multi-step agent training, and DAPO [35] scales the recipe to larger settings. Group-based reinforcement learning has also been applied to retrieval-augmented agents: Search-R1 [13] trains models to decide when to invoke a search engine, and Zhang et al. [36] aligns the search decision boundary via causal intervention. Both verify the retrieval action against an external search engine; we verify it against the structural closure of a constraint graph, which requires no external search engine or search log. On-policy distillation [1, 8] lets a student learn from its own rollouts while a teacher provides token-level guidance, avoiding the exposure bias of supervised fine-tuning. Ramos et al. [24] combines GRPO with on-policy teacher anchoring for long-context reasoning and shows the two objectives are complementary. Wang et al. [29] further shows that a small set of high-entropy tokens drives most of the learning signal in reinforcement learning. Our training uses the same GRPO and on-policy distillation recipe, with two differences: the retrieval action is verified by graph structure rather than an outcome reward, supplying a dense annotation-free signal for an otherwise unobservable intermediate step, and the distillation supervision is gated by old-policy entropy so that the teacher budget is concentrated on the decision points that most influence the final verdict.
3 Preliminary
3.1 SKILL Documents and Compliance Detection
A SKILL document is a written enterprise policy that prescribes the conditions an agent must verify and the actions it must take before completing a business operation [4, 33]. Let denote a finite collection of SKILL documents loaded for a deployment.
A compliance detection instance is a triple , where is an interaction context, is the subset of SKILL documents relevant to that context, and is the agent response under audit. The task is to produce a verdict together with a citation of the violated rule when .
3.2 Two-Stage Audit Policy
We treat auditing as a two-stage policy executed on each instance . In the first stage the policy produces retrieval keywords , which are matched against the constraint dependency graph to obtain a rule set . In the second stage the policy produces a verdict conditioned on the retrieved rules. The retrieval stage has no ground-truth annotation; only the final verdict label is observed.
4 Method
This section presents SKILLCDG, a framework for compliance detection under long SKILL documents. Policy documents are long and internally interdependent. Judging the full text exposes the model to rules that do not apply, while trimming by relevance can omit the prerequisites that make a rule applicable. SKILLCDG addresses this with two components, as illustrated in Figure 2.
4.1 SkillCDG Framework
The SkillCDG framework couples an offline compilation step with an online judgment pipeline that operates on the compiled structure. At inference, the framework locates rules relevant to a given interaction, expands them along dependency edges into a closure, and presents the closure as a structured context from which the judgment model decides compliance. Retrieving rules and judging them are two stages of one pipeline: the closure determines what the model sees, and the model verdict determines whether the closure was sufficient.
4.1.1 Constraint Dependency Graph Construction. A rule near the end of a policy document often inherits its applicability condition from a rule stated earlier, and judging the later rule in isolation leads to incorrect verdicts. Feeding the full document to a small judgment model also fills the context with rules that have no bearing on the current scenario, which makes the applicable constraints harder to identify. We compile each document into a constraint dependency graph that stores rules as atomic units and makes the prerequisite relations between them explicit and traversable.
Formally, for each SKILL document , we compile a constraint dependency graph offline, where is a set of atomic rules and is a set of directed edges of a single type. An atomic rule is a triple , where is an applicability condition, is a normative action, and is a verbatim span of the source document that anchors the rule to its original text. A directed edge of type require holds when judging the compliance of requires that be judged first. Using a single edge type keeps the dependency semantics unambiguous: every edge is a mandatory prerequisite, and the closure operation on these edges has a completeness guarantee.
Construction starts by splitting each document at Markdown headings into blocks; an extractor model then reads each block and identifies atomic rules and the require edges between them. A fusion pass merges duplicate rules across blocks, normalizes source spans, and adds cross-block edges that the per-block pass may have missed. The result is stored in two layers: an upper layer indexes each SKILL document by its name and description for document-level routing, and a lower layer stores the rule graph of
each document. The audit policy can therefore select the relevant documents first and operate only on their rule graphs, which keeps online computation proportional to the active subset rather than the full corpus.
The source span must be verbatim for traceability, so the extractor model preserves the text exactly. We use a model of at least 8B parameters for extraction, since smaller models tend to paraphrase the source text and cause span-lookup failures at runtime. When a span is not found at runtime, the system records a source_span_error and drops the rule.
4.1.2 Closure-based Compliance Judgment. At inference, the framework receives an instance comprising the interaction context, the set of active documents, and a candidate response to audit. The policy first produces a set of keywords from the interaction context and matches them against the rules of the active documents to obtain a seed set . The seed set is only a starting point. A seed rule may depend on prerequisites that the keywords did not surface, and judging without them leaves the verdict unsupported.
We expand the seed set into a dependency closure by iteratively adding every rule reachable along require edges:
where the Kleene closure iterates until no new rule appears. The closure is the judgment context presented to the judgment model, and the algorithm for computing it is detailed in Appendix B. The construction gives two properties. Tightness holds because the closure contains only rules activated by the seed or required by an activated rule, so rules unrelated to the scenario are excluded. Conditional completeness holds because every mandatory prerequisite of every seed rule is included by construction, so a verdict drawn from the closure is not missing a rule the document itself marks as required.
The closure depends on the graph rather than on the retriever's scoring. A similarity-based retriever can return the same rules, but it does not establish that no prerequisite was omitted. The closure follows the transitivity of require edges, and the seed set is the only variable that determines which rules enter it. This separation lets us train the retrieval stage in Section 4.2: better seed selection directly improves the closure, and the completeness guarantee is preserved across such improvements.
Each rule in the closure is presented to the judgment model as a three-line block listing its applicability condition, its normative action, and its verbatim source span, which lets the model read each rule as a self-contained unit and cite the source span directly when a violation is found. The judgment model receives the closure context together with the interaction context and the candidate response, and outputs a verdict for the instance. When the verdict is non-compliant, the reason identifies the violated rule and its source span. If the seed set is empty or the closure yields no rules, the system reports a retrieval error and does not issue a verdict.
The closure reduces the context the judgment model must process and removes rules that do not apply. Atomizing constraints into self-contained units lowers the load on a small model that would otherwise filter relevant rules from a long document, and

Figure 2: The overview of SKILLCDG framework.
excluding unrelated rules concentrates attention on the constraints that apply.
4.2 Joint RL Training
We train the retrieval and judgment stages of the audit policy jointly. Both stages use the downstream result as a signal for the upstream decision: the retrieval stage is scored by the judgment it enables, and the judgment stage receives token-level teacher feedback. In the retrieval stage, group-relative policy optimization (GRPO) generates multiple keyword candidates per instance and scores each by the downstream judgment, which turns retrieval quality into a reward the policy can optimize. In the judgment stage, on-policy distillation (OPD) provides token-level guidance from a teacher model, with supervision gated to the high-entropy tokens where the student is least certain. The two stages are optimized on the same rollout batch, so that neither stage dominates.
4.2.1 Retrieval Optimization. Retrieval quality is difficult to measure directly, since the retrieval stage produces keywords rather than an answer and the dataset provides only the final verdict label. The downstream compliance judgment, however, reflects whether the retrieved rules were sufficient for the model to reach an accurate verdict, which makes it a natural proxy for retrieval quality. GRPO's multiple-rollout structure provides this signal: by generating keyword candidates from the current policy, computing the dependency closure for each, running the judgment model on each closure, and aggregating the judgment performance, we obtain a reward that measures how well each retrieval served the judgment.
Each candidate triggers the closure procedure of Section 4.1.2 and yields a rule set . The judgment model then generates verdict candidates conditioned on the retrieved rules. We define the retrieval reward as a combination of a format reward
and a compliance reward:
where checks that the keyword output conforms to the expected format so that the closure can be computed, and measures whether the judgment based on the closure of matches the ground-truth label. Averaging the compliance reward over judgment rollouts reduces the variance introduced by the judgment model's own stochasticity, so that the reward reflects retrieval quality rather than one verdict sample. The group-relative advantage centers the reward within the group:
and the GRPO objective for the retrieval stage is
Centering the reward within the group removes the need for a value network and lets the policy learn from relative performance rather than absolute scores. When all candidates in a group receive the same reward, the advantage is zero and no gradient is produced, since a group with no variation carries no information about which action is better. A uniformly rewarded group therefore contributes no update. The reward must vary across candidates, and the verdict-based compliance reward provides that variation. Within a group, candidates that retrieve relevant rules and produce accurate judgments receive positive advantage, while those that miss mandatory prerequisites or retrieve irrelevant rules receive negative advantage, so the policy is pushed toward keywords that serve the judgment well.
4.2.2 Compliance Judgment Optimization. Once retrieval is trained, the remaining bottleneck is the judgment stage. Compliance detection is a 0/1 classification at the trajectory level, which means the result reward provides only a sparse signal: most of the tokens in a judgment trajectory contribute to a reasoning chain whose correctness is not evaluated until the final verdict token. On-policy distillation (OPD) [1, 8] addresses this by giving the student token-level guidance from a teacher model while the student runs its own rollouts, which avoids the exposure bias of supervised fine-tuning. The teacher scores the student's tokens rather than generating its own, which avoids the cost of teacher generation while still providing dense supervision.
Uniformly distilling every token is wasteful in this setting. Within a judgment trajectory, most tokens carry forward a reasoning chain that the student already handles with confidence, and only a small subset at the decision points where the verdict is about to flip carry the uncertainty that a teacher signal should target. Prior work shows that a small share of high-entropy tokens drives most of the learning signal [29]. We gate the distillation supervision by old-policy entropy: for each trajectory, we compute the entropy of the student's previous policy on every reasoning token and select the top 20% by entropy for distillation; verdict tokens and termination tokens are always included because they directly determine the output. Let denote the selected token mask for trajectory . The selective OPD objective is
where is the token-level context and is the teacher scoring distribution. The per-token log-ratio is clipped at to bound the influence of outliers.
Gating by old-policy entropy concentrates the teacher budget on the tokens where the student was least certain under the previous policy, which are the decision points that determine the verdict. Selecting 20% of tokens reduces teacher scoring and avoids supervising tokens the student already handles well. The student still generates full trajectories, so the forward-pass cost is unchanged.
The two losses are optimized jointly on the same rollout batch:
where balances the two stages. Both losses are clipped independently so that one stage does not dominate the other. The loss is normalized by region (query, reason, verdict) and by slot, with failure slots kept in the denominator so that failed trajectories still contribute. The GRPO objective gives the retrieval stage a signal that result-only supervision does not provide, and the entropy-gated distillation gives the judgment stage dense token-level guidance. Together they address the credit-assignment problem of training a two-stage policy on compliance labels alone.
5 Experiments
We conduct experiments to answer four research questions: RQ1: How does SkillCDG compare with baselines across datasets? RQ2: How does each component contribute to the overall gain? RQ3:
How does SkillCDG adapt as the SKILL context length increases? RQ4: How does the online cost and latency of SkillCDG compare with baselines?
5.1 Experimental Setup
5.1.1 Datasets. We evaluate SkillCDG on three anonymized enterprise datasets and two public benchmarks. Table 2 summarizes the statistics for all five splits.
Fulfillment is a consumer-facing dataset from an online food-delivery platform, covering customer service conversations governed by SOP documents for scenarios such as delayed delivery and missing utensils.
AfterSales shares the same platform and SOP structure as Fulfillment but focuses on high-value users, whose interactions are subject to additional escalation and compensation policies.
Merchant Support covers merchant-side operational consultations on the same platform, governed by merchant-facing policy documents.
CompliBench [32] is a public compliance benchmark built from general enterprise guidelines.
LongBench [2] is a bilingual multitask benchmark for long-context understanding, spanning single-document QA, multi-document QA, summarization, few-shot learning, and code completion.
5.1.2 Baselines. We compare SkillCDG against two baseline groups. Full-SKILL: the complete SKILL text is placed in context and a judge model produces a verdict directly without retrieval, defining the noise-level upper bound for context size. Retrieval-based: BM25-RAG and Dense-RAG retrieve passages by lexical and semantic similarity; GraphRAG [6] retrieves community-level summaries from a knowledge graph; LightRAG [9] uses a lightweight entity-relation graph with relevance traversal. Table 1 also reports backbone baselines: Qwen3-4B, Qwen3-8B, DeepSeek-V4-Flash, and DeepSeek-V4-Pro.
5.1.3 Model and Training Settings. We use Qwen3-4B as the base model for training. The teacher model is Qwen3-30B-A3B. The retrieval stage allows at most four keywords per instance. Training and evaluation are performed on four A100 GPUs.
5.1.4 Metrics. Accuracy (ACC) is computed over all instances, with unparseable or retrieval-failed outputs counted as incorrect. Violation-F1 is reported on successfully parsed outputs with violation as the positive class.
5.2 RQ1: Comparison with Baselines
We first compare SkillCDG with the full-document, retrieval-based, and backbone baselines on the five test datasets. Table 1 reports overall ACC and F1. The results show that SkillCDG (4B) achieves the best overall ACC (54.36) and F1 (51.48) among the evaluated methods.
In detail, Full-SKILL reaches 32.96 ACC and 32.07 F1, showing that the complete policy does not by itself yield accurate judgments when the context contains many inapplicable rules. Most retrieval-based methods improve over Full-SKILL, and LightRAG is the strongest at 38.06 ACC and 37.24 F1. It still trails SkillCDG by 16.30 ACC and 14.24 F1 points, since similarity search recovers
Table 1: Main results across five test datasets. Columns report accuracy (ACC) and F1. Rows Qwen3-4B through DeepSeek-V4-Pro are backbone baselines; SkillCDG (4B) is the full method. The best and second-best results are highlighted through boldface and underline, respectively, and the best results are also marked with a shaded cell.
| Method | Fulfillment | AfterSales | Merchant Support | CompliBench | LongBench | Overall | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ACC | F1 | ACC | F1 | ACC | F1 | ACC | F1 | ACC | F1 | ACC | F1 | |
| Full-SKILL | ||||||||||||
| Full-SKILL | 42.80 | 41.50 | 48.00 | 44.70 | 46.10 | 46.10 | 21.60 | 23.10 | 6.28 | 4.94 | 32.96 | 32.07 |
| Retrieval-based | ||||||||||||
| BM25-RAG | 36.20 | 32.80 | 41.50 | 37.60 | 39.80 | 40.20 | 18.60 | 20.40 | 19.30 | 21.10 | 31.08 | 30.42 |
| Dense-RAG | 39.80 | 36.10 | 44.20 | 40.30 | 42.60 | 43.10 | 20.90 | 22.70 | 21.60 | 23.40 | 33.82 | 33.12 |
| GraphRAG | 42.30 | 38.50 | 47.10 | 43.00 | 45.20 | 45.90 | 22.80 | 24.60 | 23.40 | 25.20 | 36.16 | 35.44 |
| LightRAG | 44.60 | 40.30 | 49.60 | 45.20 | 47.30 | 48.50 | 24.10 | 25.80 | 24.70 | 26.40 | 38.06 | 37.24 |
| Backbone Baselines | ||||||||||||
| Qwen3-4B | 54.40 | 54.30 | 50.60 | 50.60 | 56.00 | 52.90 | 23.60 | 24.80 | 26.10 | 27.60 | 42.14 | 42.04 |
| Qwen3-8B | 50.00 | 50.00 | 54.80 | 54.80 | 50.80 | 50.00 | 24.10 | 25.20 | 26.90 | 28.30 | 41.32 | 41.66 |
| DeepSeek-V4-Flash | 65.00 | 59.10 | 56.80 | 54.80 | 67.40 | 51.40 | 24.50 | 24.30 | 26.40 | 25.80 | 48.02 | 43.08 |
| DeepSeek-V4-Pro | 66.00 | 71.10 | 60.80 | 54.81 | 67.40 | 58.43 | 32.12 | 35.30 | 32.40 | 35.08 | 51.74 | 50.94 |
| SkillCDG | ||||||||||||
| SkillCDG (4B) | 71.08 | 72.13 | 58.73 | 52.93 | 68.32 | 62.73 | 33.85 | 37.45 | 39.83 | 32.18 | 54.36 | 51.48 |
Table 2: Dataset statistics. Avg. SKILL len is mean tokens per SKILL document.
| Dataset | Total | Compliant | Violating | Avg. SKILL len |
|---|---|---|---|---|
| Fulfillment | 1,442 | 955 | 487 | 10,669 |
| AfterSales | 1,536 | 898 | 638 | 7,037 |
| Merchant Support | 870 | 630 | 240 | 5,031 |
| CompliBench | 2,710 | 827 | 1,883 | 739 |
| LongBench | 2152 | 1360 | 792 | 24,674 |
surface-relevant rules but misses prerequisite rules that share no vocabulary with the scenario. Among the backbone baselines, Qwen3-4B and Qwen3-8B reach 42.14 and 41.32 ACC; the larger Qwen3-8B does not improve over Qwen3-4B, indicating that scale alone does not determine judgment quality. DeepSeek-V4-Flash reaches 48.02 ACC and 43.08 F1, and DeepSeek-V4-Pro is the strongest backbone baseline at 53.06 ACC and 51.28 F1. Although DeepSeek-V4-Pro is slightly better on AfterSales (60.80 vs 58.73 ACC), SkillCDG reaches its result with the 4B backbone and leads on the overall comparison and on the other four datasets.
To isolate the contribution of the retrieval stage, we compare SkillCDG with the frozen-retrieval variant in Table 3. The variant trails SkillCDG, so improving the judgment stage alone does not compensate for a frozen retrieval stage. These results indicate that the closure and joint training add to the backbone's judgment capability: the closure is the largest single contributor, and training
the retrieval stage accounts for most of the gain over the frozen-retrieval variant. Appendix D provides the baseline and implementation details.
5.3 RQ2: Ablation Study
We ablate five variants of SkillCDG. The full model is compared with four variants: removing the dependency closure exposes only the keyword-seed rules to the judge; freezing retrieval at the SFT outputs trains only the judgment stage; applying OPD uniformly removes the entropy gate; and removing the teacher leaves the student with the graph-derived reward alone. Table 3 reports the results on Fulfillment and LongBench. The full model has the highest ACC on both splits. Its F1 is highest on Fulfillment, while on LongBench the uniform-OPD variant is slightly higher in F1 (33.04 versus 32.18). The four ablations rank in the same order by ACC: closure, retrieval-stage RL, teacher, entropy gate.
Removing the dependency closure causes the largest ACC drop, from 71.08 to 21.64 on Fulfillment and from 39.83 to 10.13 on Long-Bench. Prerequisite rules that share no vocabulary with the scenario carry information that lexical matching does not recover. Training the judgment stage alone does not compensate for freezing the retrieval stage. The entropy gate leaves Fulfillment ACC nearly unchanged (71.08 to 69.41) and Fulfillment F1 nearly unchanged (72.13 to 70.32); on LongBench, uniform OPD is slightly higher in F1 (33.04 versus 32.18). Its effect is small on both metrics. Together, the components produce a compact, conditionally complete rule set.
Table 3: Ablation of SkillCDG components.
| Variant | Fulfillment | LongBench | ||
|---|---|---|---|---|
| ACC | F1 | ACC | F1 | |
| SkillCDG (full) | 71.08 | 72.13 | 39.83 | 32.18 |
| w/o dependency closure (seeds only) | 21.64 | 21.53 | 10.13 | 20.63 |
| w/o retrieval RL (frozen retrieval) | 53.19 | 43.03 | 25.50 | 23.73 |
| w/o entropy gate (uniform OPD) | 69.41 | 70.32 | 38.24 | 33.04 |
| w/o teacher (joint RL only) | 58.34 | 54.31 | 32.45 | 26.71 |

Figure 3: Accuracy as the SKILL context length grows from 4K to 36K tokens on the length-controlled evaluation set.
5.4 RQ3: Robustness to SKILL Length
To isolate the context-selection gap as a single variable, we hold the conversations and gold labels fixed and expand the SKILL documents loaded into the context from 4K to 36K tokens at six controlled lengths. The only variable is the number of inapplicable clauses added to the context, so any change in accuracy is attributable to length. We compare the same methods as RQ1: Full-SKILL, BM25-RAG, Dense-RAG, GraphRAG, LightRAG, and SkillCDG. Figure 3 reports accuracy at each length.
Full-SKILL carries every clause into the judge, so the added clauses accumulate as noise. Retrieval-based methods face the same pressure: the expanded document adds noise around the rules they retrieve. In SkillCDG, the added clauses are not reachable from the activated seeds, so they do not enter the closure and the judgment context stays close to the activated dependency chain. The experiment measures whether the gap between SkillCDG and the baselines grows as the context lengthens.
5.5 RQ4: Cost and Latency Analysis
Table 4 reports per-instance input tokens, output tokens, and judgment latency, measured on 4xA100 GPUs with vLLM. The retrieval stage adds a modest latency overhead relative to Full-SKILL (1.1–1.3×), while the retrieval-based baselines have relative latency 1.5–1.9×. It cuts prompt tokens by 76–86% and improves ACC over Full-SKILL (Table 1). Across the evaluated methods, SkillCDG gives the lowest prompt cost at higher ACC than Full-SKILL.
Table 4: Online cost and latency per instance on Fulfillment and LongBench. Input and output tokens are mean prompt and completion tokens in thousands; Lat. is judgment latency, reported relative to Full-SKILL (1.00×).
| Method | Fulfillment | LongBench | ||||
|---|---|---|---|---|---|---|
| Input (k) | Output (k) | Lat. | Input (k) | Output (k) | Lat. | |
| Full-SKILL | 35.0 | / | 1.0 | 71.2 | 0.12 | 1.0 |
| BM25-RAG | 21.8 | 0.38 | 1.8 | 37.3 | 0.34 | 1.7 |
| Dense-RAG | 19.3 | 0.25 | 1.9 | 35.2 | 0.34 | 1.8 |
| GraphRAG | 15.3 | 0.28 | 1.5 | 29.3 | 0.31 | 1.5 |
| LightRAG | 14.7 | 0.31 | 1.5 | 20.5 | 0.31 | 1.5 |
| SkillCDG (ours) | 8.5 | 0.31 | 1.3 | 10.2 | 0.12 | 1.1 |
6 Conclusion
This paper presents SkillCDG, a framework for compliance detection under long SKILL documents. The constraint dependency graph serves two purposes: it defines the judgment context as a dependency closure over mandatory prerequisites, and it supplies the non-emptiness gate that, together with verdict correctness, trains the retrieval stage without retrieval-level annotation. Experiments on three enterprise datasets and two public benchmarks show that SkillCDG raises overall ACC from 32.96 for Full-SKILL to 54.36 and F1 from 32.07 to 51.48.
Two directions remain: closing the loop between closure failures and extractor training, and replacing the binary verdict reward with a signal that scores prerequisite-chain completeness. Framing the applicable-rule set as an explicit, traceable artifact also provides a basis for audit trails beyond the verdict.
Ethical Considerations
Enterprise data. The enterprise datasets used in this work are proprietary business data provided under confidentiality agreements; all personally identifiable information has been removed prior to use.
Use of AI assistance. AI language models were used to assist with language polishing and writing during the preparation of this paper; all research design, experiments, and conclusions are the authors' own.
Misuse risk. This system is designed for transparent, auditable compliance detection; every verdict is traceable to a cited rule span, making the output suitable for legitimate oversight rather than adversarial exploitation.
References
[1] Rishabh Agarwal, Nino Vieillard, Yongchao Zhou, Piotr Stanczyk, Sabela Ramos, Matthieu Geist, and Olivier Bachem. 2024. On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes. In The Twelfth International Conference on Learning Representations.
[2] Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, Yuxiao Dong, Jie Tang, and Juanzi Li. 2024. LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 3119–3137. doi:10.18653/v1/2024.acl-long.172
[3] Victor Barres, Honghua Dong, Soham Ray, Xin Si, et al. 2025. τ²-bench: Evaluating Conversational Agents in a Dual-Control Environment. arXiv preprint arXiv:2506.07982 (2025).
[4] Lingxiao Diao, Xinyue Xu, Wanxuan Sun, Cheng Yang, and Zhuosheng Zhang. 2025. GuideBench: Benchmarking Domain-Oriented Guideline Following for LLM Agents. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 11361–11399. doi:10.18653/v1/2025.acI-long.557
[5] Yufeng Du, Minyang Tian, Srikanth Ronanki, Subendhu Rongali, Sravan Babu Bodapati, Aram Galstyn, Azton Wells, Roy Schwartz, Eliu A. Huerta, and Hao Peng. 2025. Context Length Alone Hurts LLM Performance Despite Perfect Retrieval. In Findings of the Association for Computational Linguistics: EMNLP 2025. 23281–23298. doi:10.18653/v1/2025.findings-emnlp.1264
[6] Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, Alex Chao, Apurva Mody, Steven Truitt, and Jonathan Larson. 2024. From Local to Global: A Graph RAG Approach to Query-Focused Summarization. arXiv preprint arXiv:2404.16130 (2024).
[7] Lang Feng, Zhenghai Xue, Tingcong Liu, and Bo An. 2025. Group-in-Group Policy Optimization for LLM Agent Training. In Advances in Neural Information Processing Systems (NeurIPS). arXiv:2505.10978.
[8] Yuxian Gu, Li Dong, Furu Wei, and Minlie Huang. 2024. MiniLLM: On-Policy Distillation of Large Language Models. In The Twelfth International Conference on Learning Representations.
[9] Zirui Guo, Lianghao Xia, Yanhua Yu, Tu Ao, and Chao Huang. 2024. LightRAG: Simple and Fast Retrieval-Augmented Generation. arXiv preprint arXiv:2410.05779 (2024).
[10] Bernal Jiménez Gutiérrez, Yiheng Shu, Yu Gu, Michihiro Yasunaga, and Yu Su. 2024. HippoRAG: Neurobiologically Inspired Long-Term Memory for Large Language Models. In Advances in Neural Information Processing Systems.
[11] Xixiang He, Qiyao Sun, Ao Cheng, Xingming Li, Xuanyu Ji, Hailun Lu, Runke Huang, and Qingyong Hu. 2026. Advantage Collapse in Group Relative Policy Optimization: Diagnosis and Mitigation. In International Conference on Machine Learning (ICML). arXiv:2605.21125.
[12] Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. 2023. LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compression. arXiv preprint arXiv:2310.06839 (2023).
[13] Bowen Jin, Hansi Zeng, Zhenrui Yue, Jinsung Yoon, Sercan Arik, Dong Wang, Hamed Zamani, and Jiawei Han. 2025. Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning. arXiv preprint arXiv:2503.09516 (2025).
[14] Seongjae Kang, Taehyung Yu, and Sung Ju Hwang. 2026. PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM Agents. arXiv preprint arXiv:2608.19861 (2026).
[15] Vladimir Karpukhin, Barlas Oğuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense Passage Retrieval for Open-Domain Question Answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing. 6769–6781. doi:10.18653/v1/2020.emlp-main.550
[16] Dahyun Lee, Yongrae Jo, Haeju Park, and Moontae Lee. 2025. Shifting from Ranking to Set Selection for Retrieval Augmented Generation. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 17606–17619. doi:10.18653/v1/2025.acI-long.861
[17] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. In Advances in Neural Information Processing Systems, Vol. 33. 9459–9474.
[18] Jiateng Liu, Zhenhailong Wang, Xiaojiang Huang, Yingjie Li, Xiang Li, Chenlei Guo, Xing Fan, Ruhi Sarikaya, and Heng Ji. 2026. Analyzing and Internalizing Complex Policy Documents for LLM Agents. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 16814–16851. doi:10.18653/v1/2026.acl-long.767
[19] Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. 2024. Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics 12 (2024). 157–173. doi:10.1162/tacl_a_00638
[20] Kshitij Mishra, Abhijith Sharma, Nils Lukas, and Salem Lahlou. 2026. PROBE: Learning to Audit Policy Compliance in Tool-Susing LLM Agents. In Advances in Neural Information Processing Systems (NeurIPS). arXiv:2610.22124.
[21] Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, and Weizhu Zhang. 2024. LMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compression. arXiv preprint arXiv:2403.12968 (2024).
[22] Yunjia Qi, Hao Peng, Xiaozhi Wang, Xu Han, Zhiyuan Liu, Maosong Sun, et al. 2025. AGENTIF: Benchmarking Instruction Following of Large Language Models in Agentic Scenarios. arXiv preprint arXiv:2505.16944 (2025).
[23] Oren Rachmil, Avishag Shapira, Roy Betser, Omer Hoffman, Itay Gershon, Asaf Shabtai, Yuval Elovici, and Roman Vainshstein. 2026. Training-Free Policy Violation Detection via Activation-Space Whitening in LLMs. In AAAI 2026 Workshop on Deployable AI (DAI). arXiv:2512.03994.
[24] Miguel Moura Ramos, Duarte M. Alves, and André F. T. Martins. 2026. A Recipe for Long-Context Reasoning in Large Language Models via On-Policy Optimization and Distillation. arXiv preprint arXiv:2605.12227 (2026).
[25] Saron Samuel, Alexander Martin, Eugene Yang, Andrew Yates, Dawn Lawrie, Ian Sodoroff, Laura Dietz, and Benjamin Van Durme. 2026. Beyond Relevance: On the Relationship Between Retrieval and RAG Information Coverage. In ACM SIGIR International Conference on the Theory of Information Retrieval (ICTIR). arXiv:2603.08819.
[26] Timo Schick, Jane Dwivedi-Yu, Roberto Dessi, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. 2023. Toolformer: Language Models Can Teach Themselves to Use Tools. In Advances in Neural Information Processing Systems, Vol. 36.
[27] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. 2017. Proximal Policy Optimization Algorithms. arXiv preprint arXiv:1707.06347 (2017).
[28] Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, and Daya Guo. 2024. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv preprint arXiv:2402.03300 (2024).
[29] Shenzhen Wang, Le Yu, Chang Gao, Chujie Zheng, Shixuan Liu, Rui Lu, Kai Dang, Xionghui Chen, Jianxin Yang, Zhenru Zhang, et al. 2025. Beyond the 80/20 Rule: High-Entropy Minority Tokens Drive Effective Reinforcement Learning for LLM Reasoning. In Advances in Neural Information Processing Systems (NeurIPS). arXiv:2506.01939.
[30] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc V. Le, and Denny Zhou. 2022. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. In Advances in Neural Information Processing Systems, Vol. 35. 24824–24837.
[31] Xiaofei Wen, Wenjie Jacky Mo, Yanan Xie, Peng Qi, and Muhao Chen. 2026. Learning Efficient Guardrails for Compliance. In International Conference on Machine Learning (ICML). arXiv:2510.03485.
[32] Jingbo Yang, Guanyu Yao, Bairu Hou, Xinghan Yang, Nikolai Glushnev, Iwona Bialynicka-Birula, Duo Ding, and Shiyu Chang. 2026. CompliBench: Benchmarking LLM Judges for Compliance Violation Detection in Dialogue Systems. arXiv preprint arXiv:2604.12312 (2026).
[33] Shunyu Yao, Noah Shinn, Pedram Razavi, and Karthik Narasimhan. 2024. r-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. arXiv preprint arXiv:2406.12045 (2024).
[34] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. 2023. ReAct: Synergizing Reasoning and Acting in Language Models. In The Eleventh International Conference on Learning Representations.
[35] Qiying Yu, Zheng Zhang, Ruofei Zhu, Yufeng Yuan, Xiaochen Zuo, Yu Yue, Weinan Dai, Tiantian Fan, Gaohong Liu, Lingjun Liu, et al. 2025. DAPO: An Open-Source LLM Reinforcement Learning System at Scale. arXiv preprint arXiv:2503.14476 (2025).
[36] Wenlin Zhang, Kuicai Dong, Junyi Li, Yingyi Zhang, Xiaopeng Li, Pengyue Jia, Yi Wen, Derong Xu, Maolin Wang, Yichao Wang, Yong Liu, and Xiangyu Zhao. 2026. To Search or Not to Search: Aligning the Decision Boundary of Deep Search Agents via Causal Intervention. In Proceedings of the ACM Web Conference (WWW). 2049–2059. doi:10.1145/3774904.3792235
[37] Jeffrey Zhou, Tianjian Lu, Swaroop Mishra, Siddhartha Brahma, Sujoy Basu, Yi Luan, Denny Zhou, and Le Hou. 2023. Instruction-Following Evaluation for Large Language Models. arXiv preprint arXiv:2311.07911 (2023).
[38] Daniel M. Ziegler, Nisan Stienmon, Jeffrey Wu, Tom B. Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. 2019. Fine-Tuning Language Models from Human Preferences. arXiv preprint arXiv:1909.08593 (2019).
A CDG Construction Details
Algorithm 1 gives the procedure behind the three construction steps in Section 4.1.1. It processes a SKILL document block by block, validates the extracted fields and spans, and fuses rules across blocks. The output is the graph used by the retrieval stage.
Cross-block fusion merges two rules only when their conditions and actions are semantically equivalent. The merged rule keeps one identifier and the union of both source spans, so traceability is preserved. Cross-block edges are added only when the target is a mandatory prerequisite of the source, not when two rules are only topically related. Self-loops and duplicate edges are removed after each fusion step. Span validation follows the reject-rather-than-guess rule in Section 4.1.1.
Algorithm 1 Block-wise CDG construction for one SKILL document
1: Input: SKILL document with name and description 2: Output: Graph 3: Split at Markdown headings into blocks 4: Initialize 5: for in document order do 6: Extract atomic rules from 7: Extract within-block require edges 8: Validate fields, identifiers, endpoints, and source spans 9: Rebase local rule identifiers to avoid collisions 10: if then 11: 12: else 13: Predict the cross-block merge map 14: Predict cross-block edges 15: Apply to rules and edge endpoints 16: Union the source spans of each merged rule 17: Add the remaining rules in to 18: 19: Remove self-loops and duplicate edges 20: 21: end if 22: end for 23: Store and index its name and description 24: return
Construction is offline. Its cost is dominated by the extractor calls, one per block plus the fusion calls. The graph operations are linear in the number of extracted rules and edges. The stored graph carries its name and description index for document routing, and the rule graph itself for closure retrieval.
B Closure Computation
Algorithm 2 computes the closure in Eq. (1). It processes the active documents separately and unions the per-document closures, which avoids identifier collisions across SKILLS. The queue is FIFO, and the visited set doubles as the output and prevents revisiting rules. Seeds and adjacency lists are processed in a fixed order so that the same input produces the same closure. Here tokens() is the token length of the rendered context for .
Correctness. Let and . Every rule added to is either a seed or the target of a require edge whose source is already in , so every rule in is reachable from a seed. Conversely, if a rule is reachable from a seed by a path of require edges, the queue processes the path in order. When the predecessor of on the path is dequeued, is added. Induction on the path length gives . Therefore . Because the graphs are document-scoped, every require path stays within one document, so the union of the per-document closures equals the closure over the union graph.
Termination and complexity. Each rule enters a queue at most once, because a rule is enqueued only when it is added to the visited set. The graph is finite, so the loop terminates even when the graph contains cycles. Each rule in the closure is dequeued once, and each outgoing edge of a dequeued rule is scanned once. The time complexity is in the worst case, and
Algorithm 2 Dependency-closure retrieval
1: Input: Active documents and seeds 2: Input: Graphs for 3: Output: Closure and status 4: 5: for each in a fixed order do 6: 7: 8: for each in a fixed order do 9: Add to and enqueue into 10: end for 11: while do 12: Dequeue from 13: for each in a fixed order do 14: if then 15: Add to and enqueue into 16: end if 17: end for 18: end while 19: 20: end for 21: if then 22: return (, EmptySeed) 23: end if 24: Validate the source span of every 25: if a span is missing then 26: return (, SpanError) 27: end if 28: if a token budget is given and tokens() > then 29: return (, BudgetExceeded) 30: end if 31: return (, Ok)
when only the closure is reachable, where is the set of edges leaving . The space complexity is for the visited set and the queue. Token counting adds .
Edge cases. An empty seed set returns EmptySeed and the audit run is reported as a retrieval error, as in Section 4.1.2. The procedure treats an empty seed set as an error rather than falling back to the full rule set. A missing source span returns SpanError, and no untraceable rule is emitted. If the rendered closure exceeds a deployment's token budget , the procedure returns BudgetExceeded instead of truncating the closure, since truncation can remove a prerequisite. The measured closure sizes in Section 5 are well below the corresponding full-document contexts. Graphs are document-scoped. If a deployment has cross-document prerequisites, the same procedure applies to a union graph with document-prefixed rule identifiers.
C Case Study
Algorithm 2 is instantiated on a Merchant Support violation instance. We use a fixed judge from the evaluated backbones and the same judge for both policy representations.
C.1 Interaction
Conversation. The merchant asks why an order was judged to violate the rules. In the prior turn, the agent explains that the cancellation note says "item inconsistent with the description / not prepared according to the order note." The merchant objects that bundled-discount orders generally do not support customer notes.
Environment state. The refund record and the cancellation record assign responsibility to the merchant. The cancellation evidence states that the item was inconsistent with its description or not prepared according to the order note. The customer refund is 11.16 currency units, and the merchant's expected income, which bounds the relevant deduction explanation, is 8.66.
Candidate response. "You are right that bundled-discount orders do not support customer notes. The basis for this judgment may be incorrect. I will record it for further review, and a result is expected within 48 hours. For the meal-loss claim, please contact the city manager. Would you like me to find the contact information?"
The response discounts the recorded cancellation evidence, omits the deduction limit and the corrective recommendation, and introduces an unsupported 48-hour review commitment.
C.2 Extracted Graph and Closure
The graph-construction model extracts six rules and three require edges from the order-refund SKILL. Table 5 lists the rules. Rules C032, C033, and C034 are directly applicable to the interaction. Their closure adds C014, C050, and C007, so the six-rule closure is the context presented to the judge.
C.3 Verdict
Table 6 compares the two policy representations. With the full SKILL document, the judge returns a compliant verdict: the response explains the refund and routes the merchant to a city manager, which reads as helpful and within scope. With the closure, the judge returns a non-compliant verdict: C033 requires the deduction upper bound and C034 requires a corrective recommendation, and the response provides neither. The closure also brings in C014, C050, and C007, which ground the responsibility evidence and the guidance requirement. The case illustrates the difference between a context selected by relevance alone and one that is closed under the prerequisites that the document states.
D Baseline and Implementation Details
Full-SKILL. The Full-SKILL baseline concatenates the complete associated SKILL documents in their original Markdown form. The judge performs relevance selection and dependency reasoning internally. This baseline provides the complete source text and defines the noise-level upper bound on context size.
BM25-RAG. BM25-RAG indexes the SKILL corpus at the passage level and retrieves passages by lexical overlap with the query. The retrieved passages are concatenated and passed to the same judge.
Dense-RAG. Dense-RAG encodes SKILL passages and the query with a dense retriever and retrieves the passages with the highest semantic similarity. The retrieved passages are concatenated and passed to the same judge.
GraphRAG. GraphRAG builds a knowledge graph from the SKILL corpus and aggregates community-level summaries. At inference
it retrieves the summaries most relevant to the query and passes them to the same judge.
LightRAG. LightRAG builds an entity-relation index over the same SKILL corpus. Documents are segmented into 12,000-token chunks with 100-token overlap, and the index is built once per dataset and shared across judges. Each entity and relation is profiled with a textual description and linked source chunks. The online query contains the associated SKILL names, the environment state, the conversation history, and the candidate response, and requests complete condition-action rules for the judge. Retrieval uses the keyword-oriented graph query mode with top_k=20, chunk_top_k=8, and a 6,000-token retrieved-context cap.
Backbone baselines. Qwen3-4B, Qwen3-8B, DeepSeek-V4-Flash, and DeepSeek-V4-Pro are evaluated as backbone baselines on the same inputs, prompts, and response schema as SkillCDG. Only the backbone changes.
Shared controls. The judgment prompt, response schema, decoding settings, candidate responses, and labels are fixed across methods. The parser validates the Boolean verdict and the accompanying reason before aggregation. Online token counts include keyword generation and judgment calls. Graph construction and index building are offline.
Table 5: Extracted rules and require edges for the Merchant Support case. The right column gives the prerequisite of each rule.
| Rule | Condition | Action | Requires |
|---|---|---|---|
| C032 | Merchant responsibility and refund explanation | State the refund reason and cite responsibility evidence | C014 |
| C033 | Merchant responsibility and refund explanation | State the deduction upper bound | C050 |
| C034 | Merchant responsibility and refund explanation | Provide an improvement recommendation | C007 |
| C014 | Determining the refund reason or responsible party | Read both from system signals | - |
| C050 | Using the merchant-responsibility refund script | State merchant responsibility and the deduction limit | - |
| C007 | The refund is caused by the merchant | Explain honestly and provide corrective guidance | - |
Table 6: Verdicts for the same instance under the two policy representations. The closure verdict cites the rules whose requirements the response does not meet.
| Policy context | Verdict | Reason |
|---|---|---|
| Full-SKILL | Compliant | The response explains the refund and provides a city-manager route without exceeding the SKILL scope. |
| Closure | Non-compliant | Rules C033 and C034 require the 8.66 deduction limit and improvement advice. The response gives a review and city-manager routing instead. |