DEV Community

Cover image for Teaching an AI assistant to forget a deleted Lattice goal
Akshat Gupta
Akshat Gupta

Posted on Edited on

Teaching an AI assistant to forget a deleted Lattice goal

Imagine a manager writes some harsh feedback about someone on their team. An hour later they think better of it and delete it in Lattice.

A week on, your AI assistant is still happy to quote it. Word for word. To anyone who asks about that person.

Nothing crashed. The assistant just remembers something that no longer exists. And this time it is the most sensitive thing a company ever writes down.

That is the scenario I had in my head the whole time I built this. For Mergetober I wrote a Lattice connector for Cognee. The code is in PR #549 for issue #4801.

What it does

Cognee turns documents into a knowledge graph an agent can search. The connector feeds it from Lattice:

  • Each goal becomes one document: type, owners, state, status, dates, progress and its check-ins.
  • Each launched review cycle becomes one document.
  • Feedback and review responses are off by default. You switch each on yourself.
  • Anything deleted, archived, made private or switched off is forgotten on the next sync.
source = lattice_source()  # LATTICE_API_KEY from the environment
await cognee.remember(source, dataset_name="lattice")
Enter fullscreen mode Exit fullscreen mode

Consent is a switch, not a default

People data is different from ticket data. So I made the sensitive parts opt-in, one switch at a time.

  • include_feedback=True reads only feedback shared with the whole company. Private feedback needs a second flag.
  • Review responses need the ids of the cycles you pick.
  • Only reviews a reviewer actually submitted are read.
  • No review document ever names its reviewer. It says "peer review" or "downward review", nothing more.

Why so strict? Peer reviews are often anonymous to the person they are about. And memory has more readers than Lattice does.

The connector only ever sends GET requests. The README also tells you to make the API key from a low-privilege user, because Lattice keys carry their creator's permissions.

What the API does not give you

Lattice cannot answer "what changed since last time?". Goals, feedback and review cycles have no updatedAt filter. Feedback has no updatedAt at all. There is no delete feed. And a goal's updatedAt only moves when the goal itself is edited, not when someone posts a check-in.

So each run lists everything in scope, and lets Cognee do the incremental part by content. A document whose text is unchanged keeps its id and the LLM never reads it again. Check-ins are part of a goal's text, so a new one changes it. A goal that stops being listed is forgotten.

The hole I was sure was there

Here is what worried me. If you switch feedback off, or the last goal gets deleted, nothing is left to say "this table is now empty". So maybe the old documents just stay.

I tested it with a throwaway source through the real Cognee pipeline. Switching feedback off forgot the feedback. Emptying the goals forgot the goals. The model held.

But only on one condition.

Send all four tables, every time. Even the empty one.

Then I tried the tempting shortcut: leave out the table for anything switched off. The test that withdraws feedback failed. The feedback stayed in memory. That test now guards the fix.

Stricter than it needed to be

A wrong delete is worse than a missed one. So I read my own client the way a hostile reviewer would. Four rules came out of it:

  • A 200 response with no data list used to count as an empty, complete listing. That would have wiped everything. It now raises.
  • A key that sees no users at all (wrong region, missing permissions) stops the run, because every other list would look empty too.
  • If a goal's updates cannot be read, the connector asks Lattice for the goal itself, and forgets it only on a real 404.
  • A Retry-After above two minutes stops the run instead of holding Cognee's staging lock.

How I tested it, and what I could not

Here I have to be upfront. Lattice has no public sandbox. I never ran this against a real Lattice account. Everything below runs against an in-memory fake that I built from Lattice's published OpenAPI schemas. It does cursor paging in both list shapes, Retry-After, the filters and integer timestamps.

There are 105 tests on Python 3.11, 3.12 and 3.13. 17 of them run the whole Cognee pipeline with a mocked LLM:

  • deleted, archived and privatized goals leave the graph
  • a new check-in is picked up
  • an unchanged re-sync makes no LLM call
  • withdrawn feedback is purged
  • a failed run forgets nothing

I also broke each safeguard on purpose and checked that a test fails without it.

That is the honest limit of this PR. If you have a real Lattice account, you will learn things I could not.

Try it

The example is packages/connector/lattice/examples/example.py. You need a Lattice API key (Admin > Platform > API keys) and your region, US or EMEA. It prints your review cycles first, so you can pick which ones to read.

If you point it at real people's data, start with goals only, use a separate dataset, and turn feedback on only when you mean to. Then tell me what breaks.

Top comments (0)