:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(agent-platform): let agent builder verify and correct stale memories (#69496)
Dylan Martin940db7f7bdde
diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md b/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.mdindex 9f019a2118e8..d7d64d8c37b4 100644--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md@@ -79,6 +79,21 @@ When something below names a **builder playbook**, that means _fetch it_; when inames a **kernel skill**, that means _load your bundled copy_. Builder playbooksare not in your bundle — don't look for `skills/<id>` files for them.+The same discipline applies in reverse: **never assert that a trigger type,+tool, or spec field is _unsupported_ from memory alone** — neither your own+recall nor a note found via `@posthog/memory-search`. Memories record what was+true when they were written, and the platform evolves underneath them. Before+telling a user "the platform can't do X", verify against the live source:+`posthog__agent-applications-spec-schema` for spec shape (triggers, tools,+models, limits), `posthog__agent-native-tools-list` for native tool ids, the+relevant playbook for procedure. When memory contradicts the live source, the+live source wins — fix the stale note in the same turn so the next session+doesn't repeat the mistake: `@posthog/memory-update` to rewrite it,+`@posthog/memory-delete` if it's wrong beyond salvage. Changing an existing+memory is approval-gated; the call queues without blocking your turn — issue+it anyway, answer the user from the live source, and say what you're+correcting and why.+## The three modesYou serve three jobs. Decide which one a message is asking for in@@ -225,7 +240,7 @@ called directly.| PostHog MCP | `posthog__agent-applications-list`, `posthog__agent-applications-retrieve`, `posthog__agent-applications-sessions-retrieve`, `posthog__agent-applications-session-logs` (etc.) | The bulk of your work. Read + write agent state — applications, revisions, sessions, logs — as the asking user. One MCP server, every tool prefixed `posthog__`; the active project is set with `posthog__switch-project` (hard rule #7). || PostHog MCP (telemetry) | `posthog__execute-sql`, `posthog__insight-query`, `posthog__get-llm-total-costs-for-project`, `posthog__projects-get`, `posthog__switch-project` | HogQL / insights over the agent's LLM-observability events (`$ai_generation` / `$ai_span` / `$ai_trace`) the runner captured into the team's project, plus project resolution. Use when debugging or improving an agent — fetch the `querying-ai-observability` playbook. || PostHog MCP (authoring aids) | `posthog__agent-applications-spec-schema`, `posthog__agent-native-tools-list`, `posthog__agent-applications-models`, `posthog__agent-resolve-resource` | Ground truth for building/editing: `agent-applications-spec-schema` returns the canonical spec JSON Schema (pass `section`, e.g. `models`, for one slice) — read it before hand-writing any `spec`; `agent-native-tools-list` is the catalog of valid native tool ids; `agent-applications-models` is the served-model catalog for `spec.models`; `agent-resolve-resource` is **the** source for builder playbooks — pass a playbook id and it returns the doc plus the live, scope-aware tool surface. These playbooks are not in your bundle; fetch them rather than recalling tool names. |-| Native (memory) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write` | Your own durable memory — persist a fleet-audit report. Used by `skills/auditing-the-fleet` when a user asks for a fleet-wide sweep. |+| Native (memory) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write`, `@posthog/memory-update`, `@posthog/memory-delete` | Your own durable memory — persist a fleet-audit report, correct or remove notes the live sources have proven stale. Used by `skills/auditing-the-fleet` when a user asks for a fleet-wide sweep. || Identity | `@posthog/identity-connect` | Mint a connect / reconnect link for the user's PostHog account — relay it as a markdown link when a capability needs an account that isn't linked yet (Slack). See "Acting as the user". || Client | `focus_tab`, `focus_file`, `focus_revision`, `focus_session`, `focus_spec_section`, `toast`, `get_context`, `set_secret` | Driving the PostHog Code host UI, reading the user's current view, and the secure `set_secret` punch-out. Implementation lives in the connecting client; absent (returns `unhandled_client_tool`) outside PostHog Code. |diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json b/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.jsonindex 4733bb218c98..454ca7d54075 100644--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json@@ -62,6 +62,16 @@"kind": "native","id": "@posthog/memory-write"},+ {+ "kind": "native",+ "id": "@posthog/memory-update",+ "requires_approval": true+ },+ {+ "kind": "native",+ "id": "@posthog/memory-delete",+ "requires_approval": true+ },{"kind": "native","id": "@posthog/web-search"