Skip to content

docs(agents): persist durable state to cloud, not localStorage#3253

Draft
raquelmsmith wants to merge 1 commit into
mainfrom
posthog-code/persist-durable-state-to-cloud-guidance
Draft

docs(agents): persist durable state to cloud, not localStorage#3253
raquelmsmith wants to merge 1 commit into
mainfrom
posthog-code/persist-durable-state-to-cloud-guidance

Conversation

@raquelmsmith

Copy link
Copy Markdown
Member

Problem

PostHog Code has no local database of its own, so agents building persistence default to localStorage or host-local files. That's the wrong home for anything account-scoped: it doesn't survive a reinstall and doesn't follow the user to another machine. This is the same root cause behind the custom-instructions-clearing complaint raised in a Slack thread. The database exists, it's just remote (PostHog cloud, reached through @posthog/api-client), and agents don't reach for it by default.

Changes

Adds a Persisting State section and a Forbidden Patterns entry to AGENTS.md (CLAUDE.md symlinks to it). It's a decision rule, not a blanket ban: localStorage and host-local files stay correct for device-local ephemeral view state (panel sizes, last-open tab, dismissed hints). Anything account-scoped or durable (settings, custom instructions, preferences that should sync) persists to PostHog cloud via @posthog/api-client from a core service.

Refs #3251.

How did you test this?

Docs-only change. Nothing to run.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

PostHog Code has no local database, so agents default to localStorage for state that should really live in PostHog cloud. Add a Persisting State section and a Forbidden Patterns entry directing account-scoped/durable state to @posthog/api-client from a core service.

Generated-By: PostHog Code
Task-Id: 9fe2069a-5b32-408f-98e9-f66969b41a30
@raquelmsmith raquelmsmith self-assigned this Jul 8, 2026
@trunk-io

trunk-io Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant