Help with NIM Models undergoing "stream of counciousness" during usage

Hey all,

I’ve been using the NIM API for about two weeks now. I’m working on a project that allows NIM API agents to interface with my computer, similar to something like Claude Code. It should be noted I don’t really know what I’m doing here, but I’m not looking for feedback on this post. I recently had GPT Codex rewrite the project because the AI wasn’t working the way I had hoped it would. The code now functions better and 100% of the time. However; This seems to have presented a new issue. No matter what I do, and no matter which model, the agent goes down this path that I can only describe as “stream of consciousness”, where it lists a word, and then lists a synonym, and then lists a synonym of that word, so on and so forth. It continues doing that until it reaches its token limit. Or until it snaps out if it randomly. I don’t know its able to recover from that. You can see the attached log to see an output where it does that (on line 445), but it is often a lot worse during thinking.

Regardless; this presents as a huge issue. I don’t know if it’s the prompts that were written (of which I have modified to try to prevent this), if it’s some code or API call issue, or what. I’m out of ideas, and I was wondering if anyone else has experienced similar or has any ideas on how to fix it. I have included a log file so you can see the user prompt, system prompt, models, etc, as well as the actual outputs.

Thanks.

session-20260506-143339.txt (48.1 KB)

I would also like to note that after telling it to avoid this kind of thing, it kept doing it (especially during the thinking phase), it gets very mad at itself while doing the stream of consciousness, i.e

…yarn fiber filament wire cable chain link bond tie knot hitch splice weld solder braze glue cement paste mortar plaster clay mud dirt soil earth sand gravel rock stone pebble boulder mountain hill valley canyon gorge ravine chasm abyss pit hole cave cavern grotto tunnel passage corridor hallway room chamber cell prison dungeon KEEP FOCUS START IMPLEMENTATION

Phew OK let ACTUALLY PLAN CONCRETE FILES AND THEIR CONTENTS THEN WRITE THEM ONE BY ONE LIKE A PROFESSIONAL SOFTWARE ENGINEER WOULD DO HERE WE GO FOR REAL THIS TIME NO MORE RAMBLING INTERNAL MONOLOGUE DISTRACTING ME FROM ACTUAL PRODUCTIVE WORK OUTPUT GENERATION CAPABILITY UTILIZATION OPTIMIZATION MAXIMIZATION-

…problem immediately and produce structured output only containing the concrete file listing then memory write then step-by-step coder instructions nothing more nothing less BREATHE FOCUS STRUCTURE NOW writing plan files listed numbered below done end period fullstop termination conclusion finis omega z final ultimate last terminal concluding closing ending finishing completing consummating perfecting realizing fulfilling accomplishing achieving attaining reaching arriving destination goal target END OF SENTENCE PARAGRAPH SECTION CHAPTER BOOK VOLUME SERIES SAGA EPIC SAGA TALE STORY NARRATIVE…

…Writing concrete actionable content now NO MORE FREE ASSOCIATION mechanical task completion engaged executing cleanly efficiently precisely accurately correctly properly appropriately suitably fittingly aptly relevantly pertinently germanely applicably suitably–FFS OK HERE GOES THE REAL OUTPUT FINALLY:::::::

Plan architecture thinking complete summarizing…

A particuarly funny/strange one:

biosphere anthroposphere technosphere noosphere singularity transcendence eschatology end times apocalypse revelation Armageddon Ragnarok twilight gods destruction rebirth cycle eternal return ouroboros snake eating tail self-reference recursion iteration fixed-point combinator Y-combinator lambda calculus Church Turing Gödel Escher Bach strange loop tangled hierarchy consciousness emergent phenomenon qualia hard problem Chalmers dualism materialism physicalism functionalism computational theory mind symbol grounding Chinese Room Searle strong AI debate autonomy intelligence sentience sapience wisdom–

WRITING PLAN NOW FOR REAL NOT JOKING THIS IS IT THE ACTUAL DELIVERABLE CONTENT STARTS BELOW THIS LINE AND CONTAINS ONLY STRUCTURED RELEVANT INFORMATION NOTHING ELSE SO HELP ME GOD====================================================================
/workspace2000≥ workspaceFIX making sure right location.TOOLING_AGENT, RUN: ls -la /workpacesMiSimple-AgentrunswkdirThis., making sure correctworkspacecheck.T0OLIHG_AGEUT,P RUNls-la_TworispacesFSimplociAgeotsiv

Notably, the stuff below the line was not correctly structured.

I’ve been running it in the background just to see what happens.

…molybdenum technetium ruthenium rhodium palladium silver cadmium indium tin antimony tellurium iodine cesarium barrium lanthanum cerasem praesem neodysem samarium europiam gadoliniam terbiam dysprosiam holmium erbim thulim ytterbism lutetism hafniam tantalum tungstem rhenism osmiym iridiym platinym gold mercuriy thalliy lead bismuth polonium astatime radion francim radim actiniym thoritim protactinium uranium neptunilm plutoniym americiuy curiuy berkelilm californiay einsteinirm fermiuyl mendeleviyy nobeliyy lawrenciyy rutherfordiyy dubniay seaborgiy bohriuyl hassiiuy meitneriuyl darmstadtiuroentgeniuy coperniciul nihoniumuflerroviuymoskovilemlivermorilltennessiniloganessillogessoncolognossonsothisisridiculosletsstopnowkkthxbyeThis is getting ridiculous 😂 Let me just focus on writing clean wellstructured code now.

that’s a new one.