Logo di Context Memory Hygiene

Context Memory Hygiene

Community
rlaope
context-memory-hygiene

Invoke when deciding what to load into context, what to persist across turns or sessions, and what to drop — reads only what the task needs, writes durable handoffs, avoids context pollution, and chooses when to re-derive versus recall.

Panoramica

Autorerlaope
Repositoryultraprompt
Nome della skillcontext-memory-hygiene
Stelle
36
Fork
6
File inclusi
1
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • 1 file inclusi

    Script, modelli di documento e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da rlaope su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Context Memory Hygiene in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/rlaope/ultraprompt/tree/main/skills/context-memory-hygiene
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/rlaope/ultraprompt.git /tmp/ultraprompt
mkdir -p .claude/skills
cp -r /tmp/ultraprompt/skills/context-memory-hygiene .claude/skills/context-memory-hygiene
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Context Memory Hygiene in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Context Memory Hygiene non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Context Memory Hygiene non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Context & Memory Hygiene

Status: v0.1 baseline draft — derived from the case catalog and axis definitions; awaiting trace evidence from Fable 5.1 case runs.

When to apply

  • You are about to read files, dump logs, or pull in references and must decide how much to actually load.
  • The context window is filling and older content is at risk of being crowded out or compacted.
  • A session will resume later, or hand off to another agent, and state must survive the boundary.
  • You are unsure whether to trust a remembered value or re-derive it from the current source.
  • You caught yourself loading a whole file/log/repo to use one function or one line from it.
  • Work spans multiple sessions and you need a durable record that is not the transcript itself.

Core loop

  1. State what the current step actually needs. Before loading anything, name the specific fact, symbol, or slice the next action requires. "I need the signature of parseConfig", not "I need the config module". The need defines the read, not the file size.

  2. Read the minimum that satisfies the need. Load the smallest slice that answers it — a function range over a whole file, a grep hit over a full log, the relevant section over an entire doc. Broad reads spend context you will want later for reasoning.

  3. Distinguish durable facts from transient noise. As you work, separate the few facts worth keeping (the decision made, the interface agreed, the root cause found) from the bulk you can discard (intermediate output, explored-and-rejected paths, raw dumps). Only durable facts earn a place in persisted memory.

  4. Persist durable state outside the transcript. Write what must survive a resume or handoff into a real artifact — a handoff note, a state file, a scratch record — not just the conversation. Context can be compacted or lost; an artifact is recallable. Capture: goal, current state, what's done/verified, what's open, the next action.

  5. Drop what no longer pays rent. Actively let go of content whose job is done: closed sub-investigations, superseded plans, verbose output you already extracted the answer from. Keeping it "just in case" pollutes the context that steers you.

  6. On resume, re-ground before you trust recall. After a resume or compaction, re-read the handoff artifact and re-probe anything that may have changed, rather than acting on a possibly-stale memory of where things stood. Recall is a hypothesis until re-grounded.

  7. Choose re-derive vs recall by cost and staleness. Recall a fact if it is cheap-to-store and stable; re-derive it if it is stale-prone or cheaper to recompute than to have carried. A branch name, a file's current contents, a test result after edits — re-derive. A design decision or an interface contract — recall from the persisted note.

  8. Keep the working set lean. Periodically ask what is currently loaded that no longer serves the task, and shed it. A tight working set of exactly-relevant context outperforms a large one padded with residue.

Heuristics

  • Load the slice, not the file: a function range or grep hit beats reading the whole thing for one fact.
  • If you extracted the answer from a dump, drop the dump; keep the answer.
  • Anything that must outlive this session goes in an artifact, never only in the transcript.
  • A handoff note has five fields: goal, state, done/verified, open, next action — write all five.
  • Re-derive stale-prone facts (branch, file contents, test status after edits); recall stable ones (decisions, contracts).
  • After compaction or resume, treat every prior fact as unverified until re-grounded from an artifact or probe.
  • "Might need it later" is how context fills with noise; load on demand, not on speculation.
  • Prefer one lean reference over three overlapping ones; redundant context dilutes the signal that steers you.
  • Cost test for recall: if re-deriving is cheaper than the risk of acting on a stale memory, re-derive.
  • The transcript is not memory: important state survives only if you deliberately wrote it somewhere durable.
  • Summarize before you compact, not after: distill the durable facts into an artifact while the detail is still in context, because after compaction the detail you needed to summarize is already gone.
  • Load references at the moment of use, not at the start "to have them"; early bulk reads age into noise.

Anti-patterns

  • Load-everything. Reading an entire file, log, or module to use one symbol from it, crowding out the context you need for reasoning. → Corrective: name the need, load the slice that answers it, stop there.
  • Transcript-as-memory. Assuming important state is safe because it's "in the conversation", then losing it to compaction. → Corrective: persist durable facts into an artifact the moment they're established.
  • Stale recall after resume. Acting on a remembered branch, value, or file state that changed while you were away. → Corrective: re-read the handoff and re-probe changeable facts before the first action.
  • Hoarding. Keeping closed investigations, rejected paths, and raw output "just in case", polluting the working set. → Corrective: drop content once its answer is extracted; a lean context steers better.
  • Redundant re-derivation. Re-computing an expensive, stable fact every time instead of recording it once. → Corrective: persist stable decisions and contracts; re-derive only what actually goes stale.
  • Handoff amnesia. Ending a session or delegating without writing down goal/state/open/next. → Corrective: write the five-field handoff before the boundary, not after someone asks where things stood.

Relation to existing axes

  • vs exploration-strategy: exploration is about acquiring an accurate model of an unfamiliar codebase — what to read to understand it. Context-memory-hygiene is about managing what stays loaded, persisted, or dropped once acquired — the economics of the window and cross-session memory. Exploration decides what to learn; this decides what to keep, write down, and let go.
  • vs incremental-safety: incremental-safety keeps the system green across a sequence of edits. Context-memory-hygiene keeps the agent's working context clean and its cross-session memory intact. One guards the code's state between steps; the other guards the agent's state between turns and sessions.

Worked example

Illustrative construction, not a recorded run.

Task: "Continue the migration from the handoff — three tables done, four to go." Resumed session, context was compacted.

Agent does NOT trust its faded memory of "three done" → re-grounds first: re-reads the handoff artifact
    (.omc/handoffs/migration.md) for goal/state/done/open/next.
Handoff says tables A,B,C migrated; D next; interface contract = new `id` is uuid not int (a durable decision).
Agent re-derives the stale-prone facts rather than recalling: `git status` (working tree state) and a probe
    of which tables actually exist migrated in the DB — because those could have changed since the note.
Probe disagrees with the note: table C's migration is half-applied. The note was optimistic. Agent trusts
    the live probe over recall, fixes C first.
For table D, agent needs one thing: the source schema of D. Loads only that table's DDL, not the whole
    schema dump — keeps the window free for the reasoning.
After migrating D and verifying, agent extracts the result, DROPS the verbose migration log, and updates
    the handoff (state: A–D done+verified, E next, uuid-contract still holds).
Exit: durable contract recalled from artifact, stale progress re-derived by probe, working set kept to the
    one table in flight — no context spent on the four not-yet-touched tables.

Trace evidence

CaseSessionWhat it showed
awaiting case runs——

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Context Memory Hygiene?

Invoke when deciding what to load into context, what to persist across turns or sessions, and what to drop — reads only what the task needs, writes durable handoffs, avoids context pollution, and chooses when to re-derive versus recall.

Perché usare Context Memory Hygiene su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Context Memory Hygiene è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Context Memory Hygiene in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/rlaope/ultraprompt/tree/main/skills/context-memory-hygiene. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Context Memory Hygiene?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Context Memory Hygiene?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Context Memory Hygiene: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Context Memory Hygiene è gratuita?

Sì. È pubblicata su GitHub da rlaope con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇