feat(addie): brand-tools MCP support for distributed brand.json (#4527)#4531
Open
bokelley wants to merge 1 commit into
Open
feat(addie): brand-tools MCP support for distributed brand.json (#4527)#4531bokelley wants to merge 1 commit into
bokelley wants to merge 1 commit into
Conversation
Adds four Addie MCP tools that author and verify variant-5 Brand Canonical Documents and brand_refs[] pointer entries per the brand-protocol 3.1 spec (docs/brand-protocol/brand-json.mdx, ratified in #4505): - publish_brand_canonical_document — generate a variant-5 doc with the brand's identity fields and validate it against the brand.json schema before returning. Hosting is left to the operator. - add_to_brand_refs — append a portfolio_entry to a House Portfolio's brand_refs[], enforcing cross-array uniqueness (brand_id not in both brands[] and brand_refs[], unique by domain and brand_id within brand_refs[]). - check_mutual_assertion — fetch the leaf and its claimed house, follow House Redirects on the house side (3-hop cap per Conformance), classify the relationship into mutual / leaf_only / house_only / standalone / unverifiable. - notify_pending_verification — send the SHOULD-level email to the house's contact.email on leaf_only edges. Rate-limited per {leaf, house} pair at one notification per 24h via the new brand_assertion_notifications table. Gated behind BRAND_ASSERTION_EMAIL_ENABLED — defaults to log-only so the new send surface is opt-in. Schema validation reuses the source brand.json schema with cross-file $refs (enums) preloaded into AJV at validator-compile time.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4527.
Summary
Adds four Addie MCP tools that author and verify variant-5 Brand Canonical Documents and
brand_refs[]pointer entries per the brand-protocol 3.1 spec (docs/brand-protocol/brand-json.mdx, ratified in #4505).publish_brand_canonical_document— generate a variant-5 Brand Canonical Document with the brand's identity fields and validate it against the brand.json schema before returning. Hosting is left to the operator.add_to_brand_refs— append aportfolio_entrypointer to a House Portfolio'sbrand_refs[], enforcing the Conformance section's cross-array uniqueness invariants (brand_id not in bothbrands[]andbrand_refs[]; unique by domain and brand_id withinbrand_refs[]).check_mutual_assertion— fetch the leaf's canonical document and its claimed house's portfolio, follow House Redirects on the house side (3-hop cap per Conformance), and classify the relationship intomutual/leaf_only/house_only/standalone/unverifiable.notify_pending_verification— send the SHOULD-level notification email to the house'scontact.emailonleaf_onlyedges. Rate-limited per{leaf, house}pair at one notification per 24 hours via the newbrand_assertion_notificationstable. Gated behindBRAND_ASSERTION_EMAIL_ENABLED— defaults to log-only so the new send surface is opt-in.Plumbing
server/src/addie/mcp/brand-canonical-tools.ts.server/src/addie/mcp/brand-tools.tsre-exportsBRAND_CANONICAL_TOOLS+createBrandCanonicalToolHandlersso existing import sites get the full surface in one file.handler.ts(web Addie),bolt-app.ts(Slack Addie), andregister-baseline-tools.ts(shared baseline).478_brand_assertion_notifications.sql— table keyed on(leaf_domain, house_domain)withlast_notified_atandnotification_count. Insert-or-update is a single statement so concurrent notifies can't both clear the cooldown.$refs(enums) preloaded synchronously at validator-compile time.Trust-tier resolution detail
check_mutual_assertionenforces the spec's "standalone trumps third-party claim" rule by short-circuiting onhouse_domainabsence — it never fetches the house when the leaf is silent. On the house side, it walks bothhouse: \"<domain>\"andauthoritative_locationredirects up to 3 hops per Conformance.Test plan
30 new unit tests in
server/tests/unit/addie/brand-canonical-tools.test.ts. Coverage:publish_brand_canonical_documentvalidates against the real source schema (sub-brand, standalone, invalid brand_id, empty names,extrafiltering, domain normalization).add_to_brand_refsenforces all three uniqueness invariants from Conformance + variant-checks the house JSON + fetches whenhouse_domainis supplied.check_mutual_assertioncovers all five tiers + redirect-chain following + 3-hop limit + failure modes.notify_pending_verificationrate-limits within 24h per{leaf, house}pair, lets a different leaf through, returnslog_onlywhen the feature flag is off (the default), and rejects invalid emails.Results: 30 passed / 30 in this test file; 3497 passed across the full
npm run test:server-unitrun (one pre-existing flaky LLM-routing test unrelated to this change). Typecheck clean.