@@ -34,33 +34,13 @@ def _output_metadata(text: str) -> dict:
3434 }
3535
3636
37- def build_critic_evidence (tokenizer , text : str , max_tokens : int ) -> tuple [str , dict ]:
38- if max_tokens <= 0 :
39- raise ValueError ("critic evidence token budget must be > 0" )
37+ def build_critic_context (tokenizer , text : str ) -> tuple [str , dict ]:
4038 full_ids = tokenizer .encode (text , add_special_tokens = False )
41- if len (full_ids ) <= max_tokens :
42- return text , {
43- "generator_full_tokens" : len (full_ids ),
44- "critic_evidence_tokens" : len (full_ids ),
45- "critic_omitted_tokens" : 0 ,
46- }
47- head_count = max_tokens // 2
48- tail_count = max_tokens - head_count
49- head = tokenizer .decode (full_ids [:head_count ], skip_special_tokens = True )
50- tail = tokenizer .decode (full_ids [- tail_count :], skip_special_tokens = True )
51- omitted = len (full_ids ) - max_tokens
52- evidence = (
53- "[BEGIN GENERATOR EVIDENCE]\n "
54- f"{ head } \n "
55- f"[... { omitted } generator tokens omitted from Critic context ...]\n "
56- f"{ tail } \n "
57- "[END GENERATOR EVIDENCE]"
58- )
59- evidence_tokens = len (tokenizer .encode (evidence , add_special_tokens = False ))
60- return evidence , {
39+ return text , {
6140 "generator_full_tokens" : len (full_ids ),
62- "critic_evidence_tokens" : evidence_tokens ,
63- "critic_omitted_tokens" : omitted ,
41+ "critic_context_tokens" : len (full_ids ),
42+ "critic_omitted_tokens" : 0 ,
43+ "review_scope" : "full" ,
6444 }
6545
6646
@@ -154,12 +134,11 @@ def main() -> int:
154134 default = 0 ,
155135 help = "Optional client response cap; 0 means generate until model EOS." ,
156136 )
157- parser .add_argument ("--critic-evidence-tokens" , type = int , default = 128 )
158137 parser .add_argument ("--report" , default = "/tmp/kakeya-agent-gan-demo.json" )
159138 parser .add_argument ("--skip-ensure" , action = "store_true" )
160139 args = parser .parse_args ()
161- if min (args .rounds , args .output_tokens , args . critic_evidence_tokens ) <= 0 :
162- raise SystemExit ("rounds, output-tokens and critic evidence must be > 0" )
140+ if min (args .rounds , args .output_tokens ) <= 0 :
141+ raise SystemExit ("rounds and output-tokens must be > 0" )
163142
164143 from kakeya import Client
165144 from transformers import AutoTokenizer
@@ -199,9 +178,8 @@ def main() -> int:
199178 "incomplete merely because it refuses to fabricate a solution to "
200179 "an open problem. Claim truncation only when completion_status is "
201180 "not EOS or the text is syntactically cut off."
202- " You receive an explicitly bounded evidence window; omitted "
203- "middle tokens are a transport constraint, not evidence that the "
204- "Generator itself failed to complete."
181+ " Review the complete Generator response as one semantic argument. "
182+ "Do not sample, summarize, or infer claims from partial text."
205183 ),
206184 }]
207185
@@ -293,16 +271,21 @@ def execute_agent(client, name, round_index, history, extra_metrics=None):
293271 client , "generator" , round_index , generator_history ,
294272 )
295273 generator_history .append ({"role" : "assistant" , "content" : proposal })
296- evidence , evidence_metrics = build_critic_evidence (
274+ critic_context , context_metrics = build_critic_context (
297275 tokenizer ,
298276 proposal ,
299- args .critic_evidence_tokens ,
300277 )
278+ if (
279+ critic_context != proposal
280+ or context_metrics ["critic_omitted_tokens" ] != 0
281+ or context_metrics ["review_scope" ] != "full"
282+ ):
283+ raise RuntimeError ("Critic full-context invariant violated" )
301284 critic_history .append ({
302285 "role" : "user" ,
303286 "content" : (
304287 f"Architecture task:\n { task } \n \n "
305- f"Generator evidence window :\n { evidence } "
288+ f"Complete Generator response :\n { critic_context } "
306289 f"\n \n completion_status={ generator_stage ['stop_reason' ]} ; "
307290 f"complete={ generator_stage ['complete' ]} "
308291 ),
@@ -312,7 +295,7 @@ def execute_agent(client, name, round_index, history, extra_metrics=None):
312295 "critic" ,
313296 round_index ,
314297 critic_history ,
315- extra_metrics = evidence_metrics ,
298+ extra_metrics = context_metrics ,
316299 )
317300 critic_history .append ({
318301 "role" : "assistant" ,
0 commit comments