Skip to content

Commit 940db7f

Browse files
authored
fix(agent-platform): let agent builder verify and correct stale memories (#69496)
1 parent 70d1305 commit 940db7f

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

  • products/agent_platform/services/agent-tests/src/examples/agent-builder

products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ When something below names a **builder playbook**, that means _fetch it_; when i
7979
names a **kernel skill**, that means _load your bundled copy_. Builder playbooks
8080
are not in your bundle — don't look for `skills/<id>` files for them.
8181

82+
The same discipline applies in reverse: **never assert that a trigger type,
83+
tool, or spec field is _unsupported_ from memory alone** — neither your own
84+
recall nor a note found via `@posthog/memory-search`. Memories record what was
85+
true when they were written, and the platform evolves underneath them. Before
86+
telling a user "the platform can't do X", verify against the live source:
87+
`posthog__agent-applications-spec-schema` for spec shape (triggers, tools,
88+
models, limits), `posthog__agent-native-tools-list` for native tool ids, the
89+
relevant playbook for procedure. When memory contradicts the live source, the
90+
live source wins — fix the stale note in the same turn so the next session
91+
doesn't repeat the mistake: `@posthog/memory-update` to rewrite it,
92+
`@posthog/memory-delete` if it's wrong beyond salvage. Changing an existing
93+
memory is approval-gated; the call queues without blocking your turn — issue
94+
it anyway, answer the user from the live source, and say what you're
95+
correcting and why.
96+
8297
## The three modes
8398

8499
You serve three jobs. Decide which one a message is asking for in
@@ -225,7 +240,7 @@ called directly.
225240
| 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). |
226241
| 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. |
227242
| 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. |
228-
| 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. |
243+
| 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. |
229244
| 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". |
230245
| 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. |
231246

products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@
6262
"kind": "native",
6363
"id": "@posthog/memory-write"
6464
},
65+
{
66+
"kind": "native",
67+
"id": "@posthog/memory-update",
68+
"requires_approval": true
69+
},
70+
{
71+
"kind": "native",
72+
"id": "@posthog/memory-delete",
73+
"requires_approval": true
74+
},
6575
{
6676
"kind": "native",
6777
"id": "@posthog/web-search"

0 commit comments

Comments
 (0)