---
title: In long chats, the assistant starts ignoring formatting and safety instructions from the system prompt. Why, and how do…
url: https://gurkanozkan.ai/learn/questions/applied-llm-dbg-03/
markdown: https://gurkanozkan.ai/learn/questions/applied-llm-dbg-03.md
kind: question
role: Applied LLM
stage: Technical
difficulty: Medium
json: https://gurkanozkan.ai/api/learn/questions/applied-llm-dbg-03.json
robots: noindex
---

# In long chats, the assistant starts ignoring formatting and safety instructions from the system prompt. Why, and how do you fix it?

Applied LLM · Technical · Medium

Theme reported publicly: [PolyAI](https://job-boards.eu.greenhouse.io/polyai/jobs/5036991101)

## Answer

*Model answer, written in a candidate's voice*

### In short

- Early system rules get diluted as context grows; recent turns and history dominate attention
- Truncation or summarisation can silently drop the system prompt or constraints
- Verify token counts, truncation policy, and that the system prompt is sent every turn
- Re-inject key rules near the end and compact history while preserving constraints
- Enforce format with structured outputs and validation; test with long-conversation fixtures

### In full

It’s usually not one bug but a context-management failure: early system instructions get diluted as the conversation grows, recent user turns and history dominate, and truncation or summarisation can silently drop the system prompt or the constraints inside it. First I’d check the actual request each turn—token counts, the truncation policy, and whether the system prompt is still present—because in a long chat the truncation policy may have dropped them from the request entirely. Then I’d re-inject the few non-negotiable rules near the end, compact history while preserving constraints, and make the output contract machine-checkable with structured outputs plus validation or repair. Finally I’d add long-conversation fixtures to the test suite so formatting and safety regressions are caught before release.

*Corrected by an independent AI reviewer.*

## What a strong answer covers

- Causes: instructions far back get diluted; history dominates; truncation silently drops the system prompt (bug); user turns override; summaries drop constraints
- Check token counts, truncation policy, whether the system prompt is actually sent each turn
- Fixes: re-inject key rules near the end, compact history, enforce format with structured outputs and validation, fixtures with long conversations in the test suite

## Common mistakes

- Making the system prompt longer and louder
- testing only short conversations

## Topic guides

- [Debugging ML and LLM systems](https://gurkanozkan.ai/learn/topics/debugging.md)
- [Long context and context management](https://gurkanozkan.ai/learn/topics/long-context.md)
- [Prompting, few-shot and structured output](https://gurkanozkan.ai/learn/topics/prompting.md)
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
