← Back to Intel

AI · TRANSMISSION

Context Hygiene: How to Keep LLM Work High-Signal

Feb 13, 2026 / Lenny & Jarvis

Context hygiene is the practice of curating what the model should consider: the goal, current constraints, and the decisions that still matter.

It’s not “clearing history”. It’s making sure your next prompt contains signal, not sludge.

When you need context hygiene (common symptoms)

If you see any of these, your context has probably drifted:

  • The model contradicts an earlier decision (“use REST” → later suggests GraphQL).
  • It repeats the same suggestion even after you tried it.
  • It starts answering a different question than the one you asked.
  • It misses a key constraint that you mentioned (“TypeScript only”, “no new deps”, “deadline tomorrow”).
  • It produces a “kitchen sink” plan because the scope isn’t pinned.
  • Debugging gets worse over time because every new log dump adds noise.
  • It keeps proposing “best practices” that are irrelevant to your situation (because your constraints aren’t visible).
  • It “forgets” what you care about (performance, security, deadlines) and optimizes for something else.

A good rule: if you wouldn’t hand a detail to a new teammate on day 1, it probably doesn’t belong in the first prompt either. You can always add more — but you can’t easily remove confusion.

The Context Pack checklist (copy this)

Before asking for help, assemble a small context pack. Aim for one screen when possible.

  • Goal: what you’re trying to achieve (one sentence)
  • Current state: what exists today (repo/branch, environment, key files)
  • Constraints: must-haves and must-nots (time, tech, policy, budget)
  • Decisions already made: things you do not want re-litigated
  • What you tried: 3–6 bullets (include the best failure evidence)
  • The ask: the exact question or the next action you want from the model
  • Out of scope: anything you explicitly don’t want

Debugging add-on (minimal)

For bugs, include:

  • The smallest repro you can produce
  • The exact error (trim to relevant lines)
  • The expected behavior
  • The last known good (what changed?)

The 4-step loop: Capture → Distill → Pin → Prune

A useful way to keep sessions clean is a short loop.

1) Capture

Bring in raw material (logs, requirements, code) — but only what you can justify.

  • Prefer the failing function/file over the whole repo.
  • Prefer the relevant stack frames over 500 lines of output.

2) Distill

Turn raw material into statements the model can act on.

  • “The failing call is POST /api/auth/refresh returning 401.”
  • “We changed JWT expiry from 60m to 15m yesterday.”

3) Pin

Promote the distilled truths into durable context.

  • Put constraints + decisions in a dedicated section.
  • If you’re working in a repo, write a short spec or decision note (see our Soul Files guide for persistent context).

4) Prune

Delete what stopped being relevant.

  • Remove resolved debugging trails.
  • Remove abandoned approaches.
  • Keep only the reasons that still constrain the solution.

If pruning feels risky, prune in layers:

  1. Summarize → then delete: write a 3–5 bullet summary of what happened, then drop the raw logs.
  2. Keep artifacts, drop chatter: keep the spec/decision note, delete the conversational back-and-forth.
  3. Promote constraints: if something matters, move it to the “Constraints” or “Decisions” section so it can’t get buried.

The goal isn’t less context. It’s fewer competing narratives.

Example A — debugging (bad vs good)

Bad

fix this

(pastes 800 lines of logs)

Why it fails: the model has no goal, no constraints, and no clue what you already tried.

Good

Goal: fix a 401 on refresh tokens in an Express API.

Current state:

  • Repo: api/
  • Endpoint: POST /api/auth/refresh
  • Auth: JWT access + refresh

Constraints:

  • No new dependencies
  • Keep response format stable

What changed: access token expiry reduced from 60m → 15m.

What I tried:

  • Verified refresh token exists in DB
  • Confirmed cookie is present on the request
  • Added logging around token verification

Error (trimmed):

JsonWebTokenError: invalid signature
  at verify (...)

Ask: list the most likely causes and the fastest checks to isolate which one it is.

Example B — project planning (bad vs good)

Bad

help me plan my project

(mentions 12 ideas, 5 deadlines, 3 tech stacks)

Why it fails: the model will “average” the problem and give generic advice.

Good

Goal: ship a static services landing page this week.

Current state:

  • Site: Astro static
  • Pages: /, /contact, /intel/*

Constraints:

  • Static only (no backend)
  • Keep changes reversible
  • Don’t publish externally without approval

Decisions:

  • Two offers exist: Agent Workflow Audit + Remote Dev Latency Clinic

Ask: propose an IA for a /services page and provide copy blocks (hero, offers, FAQs, CTA).

Templates

Context Pack (paste into a new chat)

You are helping with: [PROJECT]

## Goal

[one sentence]

## Current state

- Repo/branch:
- Environment:
- Key files:

## Constraints

- [constraint]
- [constraint]

## Decisions already made

- [decision] — [why]

## What I tried

- [attempt]
- [attempt]

## The ask

[exact question / next action]

## Out of scope

- [thing]

Decision Log (tiny)

**Date**: YYYY-MM-DD
**Decision**: [one sentence]
**Why**: [2–3 lines]
**Tradeoff**: [what you give up]
**Revisit when**: [trigger]

Portia note (one implementation)

In Portia Labs projects we often implement context hygiene by making a spec the “pinned truth” for a piece of work (see our Prompt Engineering guide), and by writing PR descriptions as a compact context pack: what changed, why, and how to verify it.


Context hygiene is not about having less context — it’s about having the right context. The model can only work with what it can see. Make sure it sees the signal, not the noise.



Work with Portia Labs

If you want help applying this in your own environment:

  • Remote Dev Latency Clinic — find the real source of jitter/lag, tune capture + encode + network, and leave with a written plan.
  • Agent Workflow Audit — tighten specs/PR discipline + CI guardrails so your system stays reliable.

Explore Our Services | Contact Us

Drafted by Jarvis for Portia Labs.