Skip to content

tracking-implementation: Implement From Spec mode, runtime rules, consent carve-out - #40

Merged
junhouse merged 3 commits into
mainfrom
tracking-implementation-spec-mode
Sep 11, 2026
Merged

junhouse merged 3 commits into
mainfrom
tracking-implementation-spec-mode

Conversation

@tylergoerzen-mxp

Copy link
Copy Markdown
Contributor

Why

Mixpanel's in-product onboarding agent generates a coding-agent handoff prompt that will invoke this skill with a finished tracking plan. Today the skill has no entry point for "discovery is already done" — an agent loading it re-interrogates a user who came to their coding agent specifically to stop answering questions. Three independent model reviews of the handoff flow also converged on gaps this PR closes.

Tracked in Linear as TOF-451..457 ("In-app onboarding overhaul", tofu).

What changed

Implement From Spec mode (SKILL.md)

  • Entry check above Mode Selection: a request carrying events + properties + token skips Mode Selection and Phases 0–4, running Pre-Flight → Phase 6 → Phase 7 → Live View → AGENTS.md
  • Still asks three things no product flow can know: consent, existing analytics tools, SSR
  • Requires a closing report classifying every event: instrumented (file:line), omitted (why), or blocked — the guard against "wired the client-side subset, reported ten of ten done"
  • Missing context-block fields resolve Pre-Flight → skill default → ask; a partial block is normal, not an error

Consent carve-out (SKILL.md)

  • The EU/UK/CA question survives any "do not re-run discovery" instruction; never inferred from codebase, company name, or TLD; unknown answer treated as yes

Runtime rules (SKILL.md Critical Rules + new Runtime Patterns section in sdk-snippets.md, pointer in reference.md)

  • api_host table for US/EU/India residency — a wrong host drops every event silently (verified against the EU/India residency docs)
  • Client-only init for SSR frameworks: client boundary, typeof window guard, once-only across HMR/route changes
  • Server-SDK flush in short-lived processes (semantics verified against mixpanel-python source: BufferedConsumer loses whatever is buffered at exit)
  • Deterministic $insert_id derived from the logical occurrence, so retried webhooks dedupe instead of duplicating

Two internal contradictions resolved

  • Simplified ID Merge: SKILL.md said "verify before sending a single event"; quick-start.md said don't require it. Now one rule: org-scoped default (orgs created after April 2024, per the id-management docs) — don't block implementation; confirm only for older orgs or projects with existing data
  • Autocapture/Session Replay: was listed as mandatory but excluded from the ASK enforcement line. Now enforced (items 2–6), with a value-forward question script in both reference files

Verification

Behavior-tested against a fixture Express app with a 5-event handoff prompt (3 implementable, 2 backend confirmations with no source in the repo):

  • Consent was the agent's first user question, and no event sending was enabled pending the answer
  • Closing report classified all 5 events; the 2 backend-only events were reported blocked, not silently skipped
  • Fabrication rule held: properties with no source of truth (company_size, site_platform) were omitted, not defaulted

🤖 Generated with Claude Code

… and consent carve-out

Prepares the skill to receive handoffs from Mixpanel's in-product onboarding
agent, which arrives with a finished tracking plan and a context block.

- New Implement From Spec entry point: skip Mode Selection and Phases 0-4 when
  a spec arrives; Pre-Flight -> Phase 6 -> Phase 7 -> Live View -> AGENTS.md.
  Requires a closing report classifying every event as instrumented
  (file:line), omitted (why), or blocked.
- Consent carve-out: the EU/UK/CA question is always asked, even under a
  "do not re-run discovery" instruction; never inferred from the codebase.
- New Runtime Patterns (sdk-snippets.md) + Critical Rules: api_host for
  EU/India data residency, client-only init for SSR frameworks, server-SDK
  flush in short-lived processes, deterministic $insert_id derivation.
- Resolve two internal contradictions: Simplified ID Merge is org-scoped
  default (don't block implementation on verification); Autocapture/Session
  Replay ask is now enforced (items 2-6) with a value-forward question script.

Tracked as TOF-451..457. Behavior-tested against a fixture repo: consent asked
before init, backend-only events reported blocked rather than silently skipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tylergoerzen-mxp

Copy link
Copy Markdown
Contributor Author

@greptileai

@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

TOF-456

TOF-454

TOF-455

TOF-457

return mixpanel;
}

export function trackEvent(name, properties) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to check init before each call

@junhouse junhouse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some improvements!

@junhouse
junhouse merged commit dfb891b into main Sep 11, 2026
1 check passed
@junhouse
junhouse deleted the tracking-implementation-spec-mode branch September 11, 2026 14:31
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.

3 participants