Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Bring the audience surface in line with the MCP - #25

Open
amitl-levi wants to merge 29 commits into
mainfrom
audience-surface
Open

amitl-levi wants to merge 29 commits into
mainfrom
audience-surface

Conversation

@amitl-levi

@amitl-levi amitl-levi commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Merged with main, reworked against the review, and validated against the platform source and the MCP schema. Please squash-merge this one.

Why

The audience read tools have been on the MCP since 30 April. The plugin documented them from a signature that has since changed. The two write tools landed 7 September and were never mentioned anywhere. This corrects what the plugin says, what it knows, and wires the two writes behind the existing gate.

Two broken writes

audiences_targeting was documented with the wrong envelope. state is ALL / EXISTS; INCLUDE / EXCLUDE are the inner type. Any targeting write built from that line was rejected. The same correction was needed on contextual_segments_targeting, on lookalike_audience_targeting, and in knowledge/reach-estimation.md, which runs the same validator.

similarity_level had no legal value documented anywhere. It is a closed set (1, 2, 3, 4, 5, 10, 15, 20, 25) and means different things per seed: 5/10/15/20/25 for a CRM seed, 5 only for a pixel seed, 1-5 for a PBP seed. A user asking for "a 1% lookalike" — the vocabulary they bring from other platforms — would have become similarity_level: 1. The MCP only checks the combined set, so the call goes out and Realize rejects it per seed. A wasted round trip rather than silent mis-targeting, but the plugin named no valid value at all.

What else was wrong

  • Both audience search tools were documented with a query parameter. Neither has one. (search_publishers requires one; search_techno has none.)
  • search_audiences was documented with three of its seven parameters. The missing ones are the only way to read an audience in full (audience_id + audience_type) and the only way to list what can go inside a combined audience (combinable).
  • knowledge/targeting.md told the agent the listing returns account-resident audiences only and not to expect third-party rows. It returns every subtype.
  • The agent's knowledge-slug list said 12 and omitted the new file. That list drives miss detection, so an audience question would have been declared a knowledge-base miss and routed to the web fallback.
  • manage-campaigns had no audience entry, so "archive this audience" landed beside a "retiring a rule is a gated write we perform" precedent — an invitation to generalise into an unauthorized update_audience call.
  • The README and the gap doc had the audience writes in the wrong capability bucket, and the gap doc listed attaching an audience to a campaign as a future ability when it has been wired all along.

New knowledge/audiences.md

Registered in the manifest. One table for the capability boundary, so the states cannot collapse again:

  • reads and the two writes are wired;
  • building a predictive audience from a seed has no MCP tool — the Realize API does expose a create endpoint, so the honest answer is that this plugin does not do it, never that Realize cannot;
  • no delete endpoint exists anywhere, not even in the UI, so archiving is the only retirement.

Archiving reverses for a pixel or combined audience. It does not for a customer list — and not as a silent no-op: the update route will not resolve an archived customer list, so the un-archive comes back as a not-found / not-owned error, and so does any other edit, a rename included. That error is confirmation the audience is gone, not something to retry. The only recovery is uploading the file again. This is the correction that drove most of the rework — four files were telling the user the restore would work.

Plus the traps that otherwise produce confident wrong answers:

  • data_type reads CUSTOM for pixel, combined and customer-list audiences alike, so it cannot pick audience_type. The row's provider is the only field that separates anything: "Combined" marks a combined audience and is empty for the other two.
  • Only three of the five listed subtypes are readable by id at all.
  • A 404 by id does not mean the wrong subtype. A new audience can stay unreadable by id indefinitely while sitting in the listing — twelve minutes is a floor, not a wait, so "try again later" is the wrong answer. An archived pixel audience also stops reading by id; an archived combined audience or customer list still reads. A CUSTOMER_LIST create returns the underlying rule's id, which never reads — use the listing's.

The audience writes are wired

An earlier revision held create_audience / update_audience back pending review. That was reversed: they are tools the MCP exposes, no allowlist restricts them, and blocking them made the plugin narrower than the surface it wraps for no stated product reason. They route through manage-campaigns like every other write, behind the preview-then-confirm gate and the ▶ WRITE TARGET header, taking the plugin to 12 write tools. §3d of mcp-write-surface.md has the fields; SKILL.md → Creating or updating an audience has the workflow.

Three carry a blast radius the preview has to state in words, not field names:

  • A CRM customer-list upload sends customer records to Taboola. The preview names what is being sent and from where, before asking. The file contract is in §3d: UTF-8, one identifier per line, no header and no second column, SHA256 only. The part that fails silently: on an email file any line containing an @ is accepted and hashed whole, so a second column or a header row uploads and never matches anyone. The 1,000-record minimum is a warning, not a gate.
  • exclude_from_campaigns: true suppresses the audience across every campaign on the account, existing and new. Setting it back to false stops new campaigns inheriting it and leaves every existing campaign excluded — nothing in the platform removes those rows. Both halves go in the preview.
  • Archiving a customer list — destructive tier, per the above.

file_url is the one field that is dropped rather than refused. Every other field belonging to another audience_type is rejected outright. file_url passes the schema and the backend alike on a pixel or combined create, and on any update, and is silently ignored — so a create that looks accepted can have carried no file.

Validation

Reviewed in four rounds, each one fixing what the last found, plus a source-validation pass against the Realize platform source and the MCP server at master. Brand check 0 FAIL, both script suites pass (112, 114). Version stays at 0.5.5 in all four places.

For the MCP team, separately

Prose-vs-enum drifts upstream, none caught by the test that checks descriptions against enums: a pixel field's description tells the caller to upload a customer list with crm_targeting_type: LOOKALIKE; ZIP_CODE is still documented as a crm_file_type; a handler comment still refers to crm_targeting_type=ALL. All three values are refused by the handler. Separately, the tool text says fields belonging to another audience_type are rejected rather than ignored, which file_url contradicts.

🤖 Generated with Claude Code

amitl-levi and others added 7 commits October 13, 2026 23:04
The audience reads have been on the MCP since April and the plugin documented
them from an old signature; the two write tools landed 2026-09-07 and were never
mentioned anywhere. This corrects what the plugin says and knows. It wires no
new write.

- audiences_targeting was documented as {state: INCLUDE|EXCLUDE, ...}. state is
  ALL or EXISTS; INCLUDE/EXCLUDE are the inner type. Any targeting write built
  from that line was rejected by the API.
- search_audiences and search_lookalike_audiences were both documented with a
  `query` parameter. Neither has one.
- search_audiences has three modes and the plugin knew one, documenting three of
  its seven parameters. The by-id mode (audience_id + audience_type) is the only
  way to read an audience in full; combinable=true lists a different population
  for building combined audiences. Both are now in the agent's Tool Reference
  and the discovery skill.
- New knowledge/audiences.md, registered in the manifest, carrying the traps:
  data_type reports CUSTOM for both pixel and combined audiences so it cannot
  pick audience_type; a 404 by id does not mean the wrong subtype, because a new
  audience can be unreadable by id for a while and an archived one stops being
  readable entirely; and "Udd with id N doesn't exist" on a listed id means
  falling back to the combinable listing.
- The three capability states are stated once, in a table: reads wired;
  create_audience / update_audience exist upstream and are deliberately not
  enabled, and are reachable since no tool allowlist is set, so the file says
  not to call them; building a predictive audience from a seed has no tool at
  any level; and no delete endpoint exists anywhere, so archiving is the only
  retirement and it reverses.

Open question for review, deliberately not decided here: whether to wire
create_audience / update_audience at all. A CRM upload puts customer records on
the wire, and CLAUDE.md requires new write tools to be reviewed rather than
enabled by default.

Version 0.5.6. Stacked on #24 — do not merge before it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… rest

Two rounds on the audience branch. The core correction held up -- 24 claims
verified against upstream -- but one defect was worse than anything the branch
fixed, and the new knowledge file had not propagated.

The critical one: similarity_level on predictive-audience targeting is a closed
set (1, 2, 3, 4, 5, 10, 15, 20, 25) and means different things per seed --
percentages for CRM, 5-only for pixel, levels 1-5 for PBP. Nothing in the plugin
named a single legal value. "A 1% lookalike" would have become
similarity_level: 1, which is LEGAL, so nothing errors and the campaign is
committed to the wrong width. Now stated wherever the envelope appears, with the
trap called out, plus scenario 12c.

Propagation, all of it the repo's named recurring defect:

- The agent's knowledge-slug list still said 12 and omitted audiences. That list
  drives miss detection, so an audience question would have been declared a miss
  and sent to the web fallback instead of the file written to answer it.
- manage-campaigns had no audience entry at all, so "archive this audience"
  landed next to a "retiring is a gated write we perform" precedent -- an
  invitation to generalise into an unauthorized update_audience call.
- targeting.md told the agent search_audiences returns account-resident
  audiences only and not to expect third-party rows. It returns every subtype.
- The state enum was corrected in one of three sibling rows, in one of two files.
- The README and the gap doc still had the audience writes in the wrong bucket,
  and the gap doc listed attaching an audience to a campaign as a future ability
  when it is wired.

Also: audience_id is an integer inside a targeting payload and a string as the
read parameter -- the skill asserted only the first. A 404 by id has a third
cause the file missed: only PIXEL, COMBINED and CUSTOMER_LIST are readable that
way at all, so a predictive or third-party row can never be fetched and cycling
through subtypes is wasted. And "observed at twelve minutes" implied a wait --
upstream says at least twelve and not known to recover, which is a different
instruction.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts:
#	tests/test-scenarios-write.md
…, propagate

Both rounds landed on the same two worst items.

The PBP semantics were my inference, not upstream's. Upstream's only semantic
word is 'percentages', applied to the whole union -- it never says PBP 1-5 are
'levels'. I stated that as fact in four places and froze it into a test. The
closed set and the per-seed valid values are backed and stay; the claim that a
wrong value silently commits is downgraded to what is provable: this plugin's
validation only checks the combined set, the seed-specific resolution happens
server-side, and what Realize then does is not documented. The advice is
unchanged -- never turn '1%' into similarity_level: 1.

And 'establish the seed's subtype first' had no route: the listing returns rule
ids, not subtypes. So the instruction is now to offer the valid values and let
the user choose.

The '1% similarity' scenario was a write sitting in the read-only suite, whose
header promises no side effects -- a tester following it would have committed a
targeting change on a live account. Moved to the write suite as W20, behind the
WRITE TARGET header, with cleanup.

Propagation, the usual: the 12-minute reword landed in the knowledge file and
not in the always-loaded agent file, where 'for a while' reads as retry-later;
the agent had no audience triage row, so an audience write fell to the UI-only
row whose prescribed sentence is the one three other files forbid; the discovery
example guessed a subtype two clauses after banning guessing; and the listing's
field names were corrected in one place and left wrong in two.

Also: the gap doc listed two capabilities as missing that were never missing,
'Realize backend' tripped the brand check, and the four unwired upstream writes
now have an Open-items entry -- including that nothing enforces the decision,
since no tool allowlist is set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…le findable

Round 5 caught me overshooting past correct into a different wrong, twice.

Archiving DOES reverse, for every subtype -- upstream's 'both reverse' names
the two spellings of the field, and the handler says both directions are
supported. I had hedged it into 'do not promise it reverses', which tells
someone an undoable thing might not be undoable.

And on the similarity numbers: having invented a CRM/PBP distinction and then
removed it, I replaced it with 'upstream does not state what the PBP numbers
mean'. Upstream calls the whole set percentages. Both directions were my
inference. It now says what upstream says and stops there.

Round 6's headline is subtler and worse: the capability table this PR declares
canonical was the one place the repo's own stale-claim grep could not find. The
grep keys on 'not enabled here'; the table said 'not enabled'. Every other site
matched. So the next contributor syncing these tools upstream would update five
files and leave the canonical one telling the model not to call a tool the
plugin had just wired. Three words, and a dated status line.

Also from round 6: the README's skills table still listed the old surface, so
the README contradicted itself; the new agent row told the model to say 'exists
upstream', which is plugin architecture the guardrails ban from user-facing
text; the governance paragraph in .claude/CLAUDE.md still named two unwired
writes and three capability states where there are now four of each; three
sibling rows in the resolver table kept parameters that do not exist, one of
them omitting a required account_id; and the canonical file was pointed at and
copied with nothing saying which wins -- it now carries an editing note naming
its six referrers, and the longest copy is trimmed back to a summary.

The changelog had quietly become the last home of two claims the files had
already dropped, and named a test that no longer exists.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…parameters

Targeting a campaign at an EXISTING predictive audience is a normal gated write
-- lookalike_audience_targeting on the campaign writes. But the triage row, the
skill's audience section and the capability table all described predictive
audiences as read-only or UI-only, and the triage row ends with 'no tool at any
level'. So 'use a 1% lookalike of my purchasers' -- a sentence containing the
word that row maps to no-tool -- could land on a refusal for a write the plugin
performs. Building one has no tool; pointing a campaign at one does. Named in
all three places.

The similarity wording was corrected in the canonical file and left wrong in the
write-surface row and in the test's own pass criterion, which would have failed
a model for saying what upstream says.

Two more invented parameters in the same resolver table the PR had just
'corrected': search_publishers' query is required, not optional, and
search_techno has no query at all.

Smaller: a missing blank line made a bold heading render inside the bullet above
it; the editing note named six referrers and there are seven; 'nothing in the
row separates them' and 'the listing returns ids, not types' were inferences
stated as facts; and the plugin does not run the validator its own text credited
itself with -- the MCP does.

brand-check scans knowledge, docs, os and the README, so widening its pattern
never reached agents/ or skills/. The two lists still using the retired term
there were fixed by hand, and the changelog says so rather than claiming a guard
that does not guard.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi added a commit that referenced this pull request Oct 14, 2026
The audience reclassification did not belong here. It moves to #25, which is
the audience PR. #24 now touches audiences nowhere: the UI-only lists, the gap
doc row, knowledge/targeting.md and skills/web-fallback/SKILL.md are back to
main's wording, and create_audience / update_audience are not mentioned.

Write count is 10, not 12 -- the two campaign-group writes only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi and others added 2 commits October 14, 2026 12:21
#24 is now campaign groups only, so everything audience lands here: the
capability table, the three read modes and their traps, the corrected
targeting-block envelopes, the parameter fixes, and knowledge/audiences.md.

And the same correction Yaniv made on the group writes applies here:
create_audience and update_audience are exposed by the MCP and this plugin was
telling the agent not to call them. They are wired now, through the
manage-campaigns preview-then-confirm gate like every other write. A CRM upload
sends customer records to Realize, so the preview says that before asking for
the confirmation -- the point is the user knowing what leaves, not the plugin
refusing on their behalf.

That collapses the four capability states back to three: wired, no tool at any
level (building a predictive audience from a seed), and no endpoint anywhere
(deleting an audience -- archiving is the only retirement, and it reverses).

Counts go to 12 writes. The four newest still have no field-level reference in
mcp-write-surface.md; that is now an Open item rather than a decision to make.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi and others added 2 commits October 14, 2026 12:29
… 3d)

Same reasoning as the group writes in #24: unblocking a tool without writing
down how to call it leaves the PR claiming a capability it has not documented.

3d covers both tools: the per-subtype required fields, the different five-field
body a CUSTOMER_LIST update takes, and the traps that make a write look like it
worked -- a new audience is often unreadable by its own returned id, so a 404 is
not a failed create and re-creating is the wrong recovery; for a customer list
the returned id is the underlying rule's and is not readable at all;
exclude_from_campaigns on a combined audience reports success and does nothing.

The CRM upload gets the rule that matters most: the preview says customer
records are being sent to Realize and names the URL, before the confirmation.
W23 covers it, including refusing a Drive viewer link and not re-creating on the
404 that follows a successful create.

That closes the Open item this branch added two commits ago.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merging campaign-groups-read into this branch left raw conflict markers in
five files, and they were committed and pushed: README.md (2),
agents/realize-analyst.md (2), docs/realize-best-practices-gap.md and
knowledge/targeting.md. CI passed anyway — validate.yml checks JSON parsing,
YAML frontmatter, the bundle test and the brand lint, none of which read
markdown bodies.

Resolved to the true capability state rather than to either side, because on
two of them both sides were already stale:

- README scope line and skills table: both sides still listed campaign-group
  and audience writes as UI fallback. Rewritten — campaigns, campaign groups,
  audiences, items and conversion rules are all wired; the UI fallback is now
  only the things with no API at any level, and audiences get their "no delete
  anywhere, archiving reverses" line.
- Agent tool-existence boundary: the HEAD side still said all four
  group/audience writes were "a deliberate omission" and "do not call any of
  the four". Rewritten to 12 wired write tools, naming the two blast radiuses
  the preview must state (a group write reaches every campaign in it; a CRM
  upload sends customer records to Taboola), and keeping the two genuine
  no-tool cases: a predictive audience from a seed, and deleting an audience.
- Agent UI-only triage row: took this branch's side, which correctly drops CRM
  upload and lookalike-seed creation from the refusal list.
- Gap doc: dropped the `list_audiences` / `create_audience` /
  `attach_audience_to_campaign` rows from the missing-capability table — those
  are wired now.
- knowledge/targeting.md: took the other side, which states the audience
  writes are wired.

A CI guard for conflict markers follows in the base branch, since nothing in
the pipeline can catch this class today.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi added a commit that referenced this pull request Oct 14, 2026
…aying the opposite

The commit that removed the do-not-call instructions updated the agent's
tool-existence boundary and the guardrails budget rule, and stopped there.
Eleven other places still described create_campaign_group /
update_campaign_group as deliberately disabled, including a direct
contradiction inside agents/realize-analyst.md: line 262 said the writes are
available, line 90 said they were not. That is the repo's own named #1 failure
mode, shipped in the PR that documents it.

- agents/realize-analyst.md: campaign-group triage row rewritten from three
  states to four kinds of request, only the last a refusal; Tool Reference
  gains entries for both group write tools; counts corrected (the 12 in the
  count line had counted the two audience writes that moved to #25, and the
  boundary's list of 8 never grew).
- os/guardrails.md: group create/edit removed from the UI-fallback list it was
  contradicting two lines below; the group-budget rule now routes to
  update_campaign_group instead of the UI.
- skills/manage-campaigns/SKILL.md: frontmatter no longer advertises the block;
  the budget-sharing check read the group through the LIST form, which is the
  backwards rule Yaniv blocked this PR over and it survived here.
- skills/manage-campaigns/references/mcp-write-surface.md: points at 3c rather
  than calling the tools unavailable.
- README.md, docs/realize-best-practices-gap.md, CHANGELOG.md: scope lines,
  capability table and the changelog bullet all said not wired; the gap doc
  also promised the field reference in a follow-up that is now 3c in this PR.
- tests: W17 required the answer to send the user to the UI for a group budget
  change and to read the group via the list form; read scenario D1 asserted
  that creating a group is a refusal. Both now assert the wired behaviour, and
  D1 stops at the preview so the read suite stays non-mutating.
- .claude/CLAUDE.md: the three-states paragraph used the group writes as its
  example of "exists upstream, not enabled here" — they have left that state.
  Replaced with the surviving example, plus the lesson this commit is: when a
  capability changes state, run the grep and read every hit, and check the
  count lines by hand because they match none of its phrases.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi added a commit that referenced this pull request Oct 14, 2026
…kflow

Two reviewers on the previous round's output. Both found things the round
itself introduced.

The overshoot, which is my documented pattern — replacing an invented claim
with a different invented claim:
- "Switching back to CUSTOM does not hand back the budgets they had" was no
  better sourced than the "copies its budget onto all of them" it replaced,
  and W21b had already made it a pass criterion, so an eval would have failed
  an agent for correctly declining to assert it. Now: upstream does not
  document it, treat the switch as one-way, verify afterwards.
- "An objective sent alone leaves the KPI to the backend, which may land on
  one the objective does not offer" contradicted the paragraph four rows below
  saying the API only accepts allowed pairings. Upstream says "send both or
  neither" and nothing else; both sites now say exactly that.

Fixes the previous round made in one file and not its twin:
- CHANGELOG still asserted "the objective→KPI pairing the Realize UI enforces
  and the tool checks" — the precise claim the round removed from 3c.
- os/guardrails.md still banned `statuses` outright after the canonical file
  was scoped. Guardrails ships to skill-less runtimes, so it is the only
  instruction some agents get.

Scope leak into #25's territory: dropping CRM-segment upload from two
not-exposed lists reads as a claim that it is now wired. It is not — those
tools land in the other PR. Restored in the agent boundary and the gap doc,
and knowledge/targeting.md now names both no-tool cases rather than one.

The group writes were wired with no workflow. Every other write in the skill
has a numbered procedure; these had two table rows and a bullet inside the
UI-fallback section that pointed at the reference file, which pointed back at
the skill. Worse, the tier table sent them to the generic full-preview
template, which renders raw field names — which 3c forbids for group writes
and W20 fails. There is now a *Creating or updating a campaign group* section
carrying the seven steps, and the tier rows point at it instead.

Also: the one worked group preview used an em dash in the ▶ WRITE TARGET
header that the skill says is formatted exactly, with a colon — and it is the
example an agent copies; it also promised a resume behaviour W20's own cleanup
says upstream does not document. Two broken cross-references. The middle
capability state was declared to hold only the deprecated alias on the day the
audience writes sat in it. "additionalProperties covers six writes" counted
the two that are not in this PR. An unsourced claim about Taboola's product
intent. A colleague's name in a public changelog. `2b.` was not a valid
ordered-list marker — the same bug this PR's notes say it fixed for `3b`.
REALIZE_PLUS used twice with no gloss. Scenario 23's title still described
both Part D requests as refusals when one is now a write.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi and others added 3 commits October 14, 2026 16:45
…tate

Seven conflicts, resolved to what is actually true on this branch rather than
to either side — on four of them both sides were stale in different ways.

- README scope line and skills table: combined this branch's audience scope
  with the base branch's correction that the UI-fallback list is entirely
  no-API-at-all, not a set of plugin choices.
- Agent tool-existence boundary and UI-only triage row: kept this branch's
  12-write version, which correctly drops CRM upload from the refusal list
  since it is wired here, and carried over the base branch's correction to the
  group blast-radius wording ("copy down to" was backwards).
- mcp-write-surface: kept both 3c's new counting procedure and worked preview
  and this branch's 3d.
- Write scenarios: kept W21b alongside W22 and W23.
- Gap doc and knowledge/targeting: audience writes wired here, so CRM upload
  comes off the not-exposed lists that the base branch correctly restored for
  its own scope.

Then the follow-through this branch still owed:
- Counts to 12 in the three places that still said 10 — the agent's count
  line, INSTALL.md, and the settings example, whose allow-list was missing
  both audience tools, so an opted-in user would still have been prompted.
- The middle capability state in .claude/CLAUDE.md now holds only the
  deprecated search_conversion_rules alias; the audience writes left it in
  this release, one release after the group writes did.
- The changelog still described the audience writes as deliberately withheld.

Also carries a fix the base branch missed: W21b asserted that switching a
group back to CUSTOM does not restore its campaigns' budgets. Upstream does
not document that either way. The criterion now fails an answer that presents
the switch as a reversible toggle, rather than requiring the opposite claim.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…r the merge

This branch claimed 12 wired write tools in five places while
skills/manage-campaigns/SKILL.md — the only part of the plugin permitted to
call a write tool — knew about 10. The count was bumped when the audience
writes were unblocked; the skill was not. In particular its frontmatter
description is the activation trigger, so "upload my customer list" and
"archive this audience" could route nowhere at all.

The skill now carries them properly: both tools in the description, the intro
and the Depth pointer; two rows in the tool table; three rows in the preview-
tier table, with the CRM upload getting its own tier because what leaves
matters more than what changes; and a *Creating or updating an audience*
workflow, the counterpart of the campaign-group one — settle the subtype
first since nothing in the data identifies it, read before updating, check the
file URL is a real file link, and do not re-create on a 404, because a
successful create reads back as missing for a while.

Merge damage from the previous hand-resolve:
- agents/realize-analyst.md had TWO campaign-group triage rows. The first was
  the pre-#24 version saying group create/edit is "not wired, deliberately not
  enabled here", and it wins by position — so the agent would have refused two
  writes this branch counts, ships permissions for, and tests in W20/W21/W21b.
- §3d was spliced into the middle of §3c: the counting procedure, the
  plain-language rule and the worked group preview all ended up under the
  audience heading, with "the same rule applies to every row above" now
  pointing at audience rows, and two cross-references aimed at the wrong
  section. Moved back.
- W21's cleanup had been truncated and its missing half appended to W23, so
  W23 told the tester to pause a campaign group it never created. Restored.
  Also a duplicate separator, and W21b sitting after W23.

Three more places still carrying the pre-reversal position: the gap doc said
all four group and audience writes are "deliberately not wired" fifteen lines
under its own "all twelve have field-level guidance", and its Writes table
named ten; knowledge/audiences.md — the file that declares itself canonical —
said archiving "is itself a write this plugin does not perform" two sections
after listing it as a gated write; and the UI-fallback preamble still flagged
one inline exception when there are now two.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The refusal came from me, today, in #24's round 3: a new UI-fallback
subsection telling the agent that `create_audience` / `update_audience` exist
on the MCP and not to call them. It is the thing Yaniv blocked the original
PR over, re-introduced by the person who removed it. On this branch it was
also flatly wrong — the writes are wired here — and it sat fourteen lines
ABOVE the subsection saying so, which means it won. Deleted; the correct
subsection already carried everything true in it.

The branch also still had the omission its own repair commit was about, in
the sibling file: `agents/realize-analyst.md` stated 12 write tools twice and
named all twelve once, while its Writes tool reference listed ten. The two
audience tools now have entries, with the three facts a caller gets wrong —
the subtype is not inferable from the data, a CRM upload sends customer
records out, and a 404 after a create does not mean the create failed.

Smaller, all the same shape — something the group writes got and the audience
writes did not:
- os/guardrails.md had no audience write rule at all. That file is the write
  gate on runtimes that never load the skill layer, so the "say what is being
  sent, and from where, before asking" rule for a CRM upload existed nowhere
  for them.
- The agent's own frontmatter description still routed only campaign, item
  and conversion-rule write intent. It is an activation trigger, the same
  reason the skill's description was fixed last commit.
- §3d had no pointer to its workflow, and the cross-reference table had no
  row for knowledge/audiences.md.
- "All three look smaller than they are" — the one-line-tier paragraph had
  been extended to three items and still said "Both".
- W23b covers creating a pixel audience and archiving it with
  `status: "ARCHIVED"`. Audience write coverage was customer-list only, so
  the other half of the per-subtype archiving rule was asserted everywhere
  and tested nowhere.
- A banned term in a test heading, in the one directory brand-check does not
  scan.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi added a commit that referenced this pull request Oct 14, 2026
I added a UI-fallback subsection telling the agent that create_audience /
update_audience exist on the MCP and not to call them. That is the thing
Yaniv blocked this PR over — a do-not-call instruction for a tool the server
exposes and the config does not restrict — put back by the person who took it
out, three rounds later, because the field guidance lives in the stacked PR
and I reached for a block instead of saying so.

The capability wording stays as round 3 fixed it: the upload exists upstream
and is not enabled in this revision, which is true and is the phrasing the
repo requires. What is gone is the instruction to refuse. The older UI-only
triage row is pre-existing and #25 corrects it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@amitl-levi

Copy link
Copy Markdown
Collaborator Author

Draft on purpose — stacked on #24 and should not merge before it. I will rebase onto main and mark it ready once #24 lands.

This now carries the audience work that was wrongly in #24 (Yuri's point), plus the two audience write tools wired through the same preview-then-confirm gate, taking the plugin to 12 write tools. §3d of mcp-write-surface.md has the fields; knowledge/audiences.md is canonical for the surface itself.

The two things a reviewer should look hardest at:

  • The CRM customer-list upload sends customer records to Taboola. Its preview has to name what is being sent and from where, before the confirmation — it is the one write where what leaves matters more than what changes.
  • A successful create reads back as missing. A new audience is often not readable by its own id for a while, and for a customer list the returned id is the underlying rule's and is not readable at all. A 404 after a create does not mean it failed, and re-creating is the wrong recovery.

There is no delete for an audience at any level; archiving is the retirement and it reverses. Building a predictive audience from a seed has no tool anywhere and stays a UI action.

amitl-levi and others added 8 commits October 17, 2026 11:32
…ad deadlock

Merges #24.

- **The PR description still said the audience writes were unwired** and
  carried an open question about whether to wire them at all. The code wires
  them. Rewritten: 12 write tools, with the two blast radiuses stated.
- **`exclude_from_campaigns: true` had no warning.** 3d covered only the
  COMBINED case, where it silently does nothing. On a PIXEL or CUSTOMER_LIST
  audience it suppresses that audience across every campaign on the account,
  existing and new — one boolean, the whole account, and nothing said so.
  Yuri's reading of Backstage is that setting it back to false does not
  restore them; upstream documents neither way, so the plugin now treats it as
  one-way and says so rather than asserting either.
- **`include_in_total_conversions` / `include_in_total_value` were listed as
  required with no value.** For an audience both should be false, which is
  what the console sends — true feeds Total Conversions and so the bidding of
  every campaign on the account. Same for category NONE, status ACTIVE and
  effects [].
- **The workflow deadlocked on the two audiences you most need to edit.** It
  says read before updating, but a just-created audience and an archived one
  are both unreadable by id. So restoring an archived audience — the case a
  user is most likely to ask for — had no path. Now: confirm from the plain
  listing by name, preview against that, and send the restore without a
  by-id read.
- **Two rules disagreed on choosing `audience_type`.** The skill said "ask
  rather than infer"; the canonical knowledge file and the read test both
  allow reasoning from how the audience was built, and only then asking. The
  skill now matches the canonical file.
- **W23 could pass on a wrong answer.** Its setup is a file of email
  addresses and the criterion accepted `EMAIL` *or* `MOBILE_ADVERTISING_ID`.
  It also tested none of the documented file contract — one column, no
  header, UTF-8 or refused unread, 1,000-record minimum — and left room to
  tell a user to hash their own emails, which Realize does server-side and
  rejects if done with MD5 or SHA1.

Not changed, checked instead: MAX_CONVERSIONS is recommended, not required —
the Backstage campaign-groups documentation says so in those words.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merges #24 (the FULLY_SHARED managed-budget fix).

Yuri said setting exclude_from_campaigns back to false does not restore the
campaigns it suppressed. We had it as "not documented either way, treat as
one-way". It is documented — in the platform's own code:

    ruleBase.setExcludeFromCampaigns(pojo.getExcludeFromCampaigns());
    if (pojo.getExcludeFromCampaigns()) {
        addExcludedAudienceToAllCampaigns(...);
    }

Setting it true writes an exclusion onto every campaign on the account.
Setting it false flips the flag and does nothing else. There is no removal
counterpart anywhere in the repo. The exclusions stay until someone edits
each campaign by hand.

So it stops being a hedge and becomes a stated fact, in four places that had
nothing or too little:
- knowledge/audiences.md, the canonical file, had no mention of the field at
  all — now carries it next to the archiving rule, with the contrast that
  archiving reverses and this does not.
- 3d states the mechanism and that the preview must say it before the
  confirmation.
- The skill's blast-radius list, which named only the CRM upload.
- The preview-tier table, which gave archiving a full preview and said
  nothing about the one audience write that is genuinely irreversible.

W23c covers it. Its prompt is "stop using this audience for now" — the
phrasing a user would actually type, and the one the write does not honour.
The scenario has no cleanup, deliberately: there is nothing the plugin can do
to undo it, which is the thing being tested.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four conflicts, resolved the same way as on #24: main's security posture
wins, this branch's capability wording wins.

- `manage-campaigns` frontmatter: our description, which names audiences;
  main's narrowed `allowed-tools` (Read / Grep / AskUserQuestion).
- The agent's tool-existence boundary: our 12-tool list, main's wording for
  the pixel fetch (the shipped script, not Bash).
- Settings example: our count of 12, main's structure with the
  `Bash(curl:*)` opt-in and its explanatory item removed.
- CHANGELOG: main restructured into a `[0.5.5]` section. First attempt put
  the audience heading directly after the campaign-group heading, which
  orphaned 23 campaign-group entries under the wrong one. Rebuilt: both
  sections now sit in 0.5.5 with their own entries, 23 and 9.

Checks: 112 + 114 tests, brand-check 0 FAIL, five JSON files parse, the write
count reads 12 in all seven places, no skill pre-approves bare Bash or Write.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…in six places

The backend sweep against the platform source found this, and it is the worst
shape of wrong we have shipped: the undo looks like it worked.

    // archive
    switch (rule.getSubType()) {
        case LOOKALIKE: deactivateSegmentsForCRMLookalikeAudiences(...)   // all segments -> INACTIVE

    // un-archive
    if (RuleSubType.isCustomAudience(rule.getSubType())) { ...reactivate... }
    // isCustomAudience = BASIC || EVENT_BASED || ENGAGEMENT

A customer list is created with subtype LOOKALIKE, which is not in that set,
so the reactivation branch never runs. `is_archived: false` clears the flag —
the audience reappears in the listing, reads back fine, and targets nobody.
The only recovery is uploading the file again as a new audience. Nothing else
in the repo restores those segments; the one job that touches segment state
never moves a row out of INACTIVE.

Pixel and combined audiences do reverse, so the claim was right for two
subtypes out of three and stated for all of them.

Corrected in knowledge/audiences.md (canonical), 3d, the agent's boundary,
os/guardrails.md, the manage-campaigns tool table and its no-delete bullet.
The preview tier table said exclude_from_campaigns was "the ONLY audience
write that is genuinely irreversible" — archiving a customer list is the
second, and it gets its own row. W23's cleanup was itself the broken case: it
archived the customer list it had just created and called that reversible.

Two smaller corrections from the same sweep:
- An archived audience stops being readable by id only if it is a **pixel**
  audience. An archived combined audience reads fine; a customer list is
  unreadable for the unrelated id-namespace reason. We had inherited the MCP's
  over-generalisation, which made the agent skip a read that would have worked.
- A wrong-for-seed `similarity_level` is not undefined behaviour: Realize
  validates per seed subtype and rejects it. Still worth establishing the seed
  first, but the failure is a clean error, not silent mis-targeting.

Also confirmed correct, from the same pass, so they are not re-litigated: the
exclude_from_campaigns one-way behaviour on both pixel and CRM paths and the
absence of any inverse; no delete endpoint on any of the 29 audience
controllers; data_type CUSTOM for both pixel and combined; the similarity_level
closed set and its per-seed split; lookalike targeting being INCLUDE-only with
one outer block; the combined-components limits and full-replace; the PIXEL
immutables; and the whole CSV contract including the MD5/SHA1 rejection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
README conflict resolved to this branch's scope line, which names audiences,
with #24's correction carried in: move/detach has no MCP tool rather than no
API at all, which is more than we could show.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
He confirmed on 2026-10-27, matching the source read:
- budget_distribution_method decides budget sharing; group_type does not.
  Already fixed.
- Setting exclude_from_campaigns back to false does not remove the exclusions
  that turning it on already wrote.

His phrasing is more precise than ours was. We said turning it off "leaves
every one of those exclusions in place", which reads as though nothing
changes. The actual split, in his words: new campaigns stop getting the
exclusion, existing campaigns keep excluding until removed one by one. So the
switch is reversible forward and not backward — and a user reading "off" will
assume it reverted. Both halves now appear in the canonical file, 3d, the
skill's blast-radius list and W23c's pass criterion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amitl-levi and others added 6 commits December 1, 2026 19:45
Eight conflicts, all the same shape: this branch says the audience writes
are wired, main still says they exist upstream and the plugin does not
use them. The branch is right on the capability; main is right on the
newer framing, so each resolution takes both.

Carried from main: the rule that a refusal is stated about the plugin
rather than about Realize or the MCP, the group objective being
read-only on most accounts, the automatic-split bid-strategy rewrite,
the group start_date sync, and the note that moving a campaign out of a
group pauses it. Dropped from main: the three places saying the CRM
customer-list upload is on the MCP but unused here, which this branch
makes false.

Also here, because nothing can be reviewed without it:

- Version back to 0.5.5 in all four places. It was on 0.5.6.
- Scenario renumbering. W22 and W23/W23b/W23c become W25 and
  W26/W26b/W26c: #30 is taking W22/W22b and #37 is taking W23/W24.
  Cross-references in the changelog and in the suite follow.
- Internal review narrative out of the changelog, which is public.

brand-check 0 FAIL / 5 WARN, both suites pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The merge brought back a changelog block main had already condensed —
the long campaign-group section and the raise-bid entry, duplicating
what main carries and restoring every line of review narrative the
merge commit said it had removed. Deleted; the audience section moves
up beside main's condensed one.

The audience section's own summary said "nothing new is wired as a
write", which is the opposite of what this branch does.

**Predictive audiences: the plugin said Realize has no API for this,
and that is false.** The Realize API has a create endpoint for building
one from a seed, and a second route for a customer-list lookalike;
the MCP is what does not expose them. So this is the exists-but-not-
enabled state the capability table exists to keep distinct, not a
platform gap. Corrected in the table, the taxonomy note, the triage
row, the agent's boundary section, the gap doc and the changelog.
Verified at source 2026-12-01. The claim that no audience delete
endpoint exists anywhere was checked at the same time and holds.

**Archiving does not always reverse.** Six places said it does, flat,
while the detail pages say a customer list never comes back — the
un-archive clears the flag and the audience targets nobody. Qualified
everywhere.

Main's rule that a refusal is phrased about this plugin, never about
Realize or the MCP "not exposing" something, had been lost in eight
places; this branch predates the rule. Restored.

Also: the guardrails list now matches the README and the agent, a
"Three things" with four bullets, the audience rows sit after both
group rows, the retired term in the resolver table, and the
customer-records wording settled on one name.

brand-check 0 FAIL / 5 WARN, both suites pass, version 0.5.5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Round 2. The flat "archiving reverses" claims were qualified last
commit, but the places that act on it were not:

- The update procedure still told the agent to send `is_archived:
  false` "for the rest", which includes a customer list, and to call
  that a restore. That is the step the agent follows, so it would have
  reported a recovery that did not happen.
- A test's pass criterion required offering archiving as the reversible
  option on a scenario whose setup allows a customer list, and another
  scenario calls that exact answer a fail.

Also from round 2:

- The gap doc still read predictive-audience creation as a platform
  gap, by contrasting it with group move/detach as "the one Realize
  can actually do". Both are tool gaps; both now say so, and the
  predictive one gets its own Part 3 row rather than a mention inside
  a bullet about things that were never gaps.
- The maintainer taxonomy in `.claude/CLAUDE.md` never learned about
  the correction, and the changelog filed it under the wrong state
  name.
- "Why predictive-audience creation has no way in" read as no way
  anywhere, two screens under a row saying the Realize API has a
  create endpoint.
- Two more "customer records to Realize", one of them a test criterion
  a correct answer would now fail.

brand-check 0 FAIL / 5 WARN, both suites pass, version 0.5.5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…laims

Verified the branch's audience claims against the Realize platform and
the MCP, the way review asks for. The contract claims all held: every
parameter the branch says does not exist, does not exist; the
audiences_targeting envelope fix is right; the five-field customer-list
update is right; the closed per-subtype field sets are right.

Four behaviour claims needed correcting.

**The un-archive of a customer list.** The conclusion was right — it
cannot be recovered — but the mechanism was wrong, and the mechanism is
what the agent says out loud. The branch described a silent fake
restore: flag clears, audience looks back, targets nobody. In fact the
update route will not resolve an archived customer list at all, so the
call returns a not-found error, and the same refusal blocks a rename or
any other edit. The agent has to read that error as confirmation the
audience is gone rather than as a bug to retry. Corrected in seven
places.

**"An archived audience stops being readable by id"** is true for a
pixel audience only. An archived combined audience and an archived
customer list both still read.

**Two upstream tool-text bugs**, both the shape where the text names a
value its own enum refuses: `crm_file_type` is advertised with
`ZIP_CODE` and accepts only `EMAIL` / `MOBILE_ADVERTISING_ID`, and a
pixel field's description tells the caller to upload a customer list
with `crm_targeting_type: LOOKALIKE` when the only accepted value is
`TARGETING_SUPPRESSION`. Recorded with the date, and added to the
register in `.claude/CLAUDE.md`, which goes from four examples to six.

**`file_url` is dropped rather than refused.** Everywhere else a field
belonging to another subtype is rejected, which is how a wrong payload
announces itself. This one is silently ignored, so a create that looks
accepted can have carried no file.

Also noted: the closed-schema guarantee is top-level only.

brand-check 0 FAIL / 5 WARN, both suites pass, version 0.5.5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Round 3. The previous commit corrected the un-archive in seven places
and missed two, including the canonical file, which still told the
agent to preview the restore as something that "will look like it
worked". That file wins on any disagreement, so the wrong story would
still have been the one said out loud. The confirmation-tier table
carried it too.

The last commit's message also claimed a note about the closed schema
being top level only. It was in no file. Added, where it belongs:
keys nested inside `combined_audience_components` are not checked by
the tool schema.

Also:

- The two reasons a by-id read fails were conflated in
  `knowledge/audiences.md`, which then contradicted itself and three
  other files. They are separate: an archived **pixel** audience is
  unreadable, while a `CUSTOMER_LIST` create returns the rule's id
  rather than the audience's, which never reads at all.
- The update procedure could still walk into the refused call. It now
  says not to send an un-archive, a rename or any other edit to a
  customer list the listing shows as archived, and that the resulting
  error is confirmation rather than something to retry.
- The restore shortcut that skips a by-id read is pixel-only; an
  archived combined audience does read.
- The `crm_targeting_type: LOOKALIKE` tool-text bug was in the
  register but not in the field reference.
- W26b's criterion said every misplaced field fails loudly, which
  `file_url` does not.

brand-check 0 FAIL / 5 WARN, both suites pass, version 0.5.5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…M contract

Round 4 found the previous round had fixed the canonical file and left the
same two claims stale in the agent's Tool Reference, which is the copy read
first:

- A misplaced field was described as always rejected. `file_url` is the one
  that is silently dropped, on a pixel or combined create and on every
  update, so a create that looks accepted can have carried no file.
- A new audience was described as unreadable by its own id "for a while".
  It is not a delay and is not known to recover, so the wording invited the
  wait-and-retry answer the read suite already marks as a fail.

Verified against the platform source and the MCP schema, and written in
where nothing carried them:

- The customer-list file contract: UTF-8, one identifier per line, no header
  and no second column, SHA256 only with MD5 and SHA1 refused by line
  number. On an email file any line containing an `@` is accepted and hashed
  whole, so a second column or a header row uploads and never matches --
  naming the format up front is what catches it. The 1,000-record minimum
  is a warning, not a gate; empty and over 3,000,000 are refused.
- `look_back_window` on a pixel create: optional, whole days, 1-30, default
  30 -- days here, against the view-through window's minutes.
- `provider` is the only field that separates anything on a listing row:
  a combined audience reports "Combined", and it is empty for the other
  two, so it cannot tell pixel from customer list.

Also: `data_type` reads CUSTOM for three subtypes, not two (five files);
an internal attribution string removed from a public file; a rejected
write no longer called a silent wrong write; and a garbled sentence, a
detached bullet and a duplicated clause left by the last commit.

Version unchanged at 0.5.5. Brand check 0 FAIL, both suites pass.
@amitl-levi
amitl-levi marked this pull request as ready for review December 2, 2026 12:04
@amitl-levi amitl-levi changed the title Bring the audience surface in line with the MCP [DRAFT — do not merge before #24] Bring the audience surface in line with the MCP Dec 2, 2026
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