Skip to content

docs: AI sales automation revamp implementation plan#1

Draft
gorajing wants to merge 2 commits into
mainfrom
feature/anthropic-gtm-revamp-plan
Draft

docs: AI sales automation revamp implementation plan#1
gorajing wants to merge 2 commits into
mainfrom
feature/anthropic-gtm-revamp-plan

Conversation

@gorajing
Copy link
Copy Markdown
Owner

@gorajing gorajing commented May 7, 2026

Adds the reviewed implementation plan for the AI sales automation revamp.

What this is

  • PLAN-ai-sales.md — strategic phases (high-level)
  • docs/superpowers/plans/2026-05-06-ai-sales-automation-revamp.md — task-by-task TDD-style executable plan; supersedes the parent on conflicts

Review boundary

This PR is for plan approval. Implementation lands separately from this plan branch and can be rebased onto main once this lands.

Plan stats

  • 5,510 lines · 30 tasks · 154 bite-sized steps
  • 8 codex review rounds; final return: "no substantive issues remain"
  • Additionally patched against a fresh-eyes review (dedupe key cross-account collision, case-insensitive duplicate precheck, gitignore directory pattern, plan-vs-plan drift)
  • Naming generalized from a single-company Anthropic GTM framing to a reusable AI sales / GTM role framing

Out of scope here

  • Real Salesforce/HubSpot/Outreach API integrations (stubs only)
  • SaaS / multi-tenant DB
  • Real email send (still .eml export)
  • Postgres migration

🤖 Generated with Claude Code

gorajing and others added 2 commits May 6, 2026 20:14
PLAN-anthropic.md sketches the strategic phases; the detailed
plan under docs/superpowers/plans/ is the executable, TDD-style
task-by-task version that supersedes the parent on conflicts.
Iterated through 8 codex review rounds to clean: schema correctness
(routing rules in Markdown only, partial unique indexes via the
sqliteTable extra-config builder), idempotency at every entry
point (signal ingest, scoring, routing, alerts via reserve-then-send),
trustedSender gating for verification, deterministic timestamp
ordering, and provenance preservation through connectors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gorajing gorajing changed the title docs: Anthropic GTM revamp implementation plan docs: AI sales automation revamp implementation plan May 8, 2026
gorajing added a commit that referenced this pull request May 10, 2026
Codex flagged 3 SHOULD-FIXes:

1. Per-rule rounding silently zeroed small weights for the last fraction
   of their window (a baseWeight=5 rule contributed 0 for ~10% of its
   window). Switched return type to fractional float; consumers in
   lib/scoring/score.ts will sum and round only at the final score.
   This also eliminates Math.round's sign asymmetry (+0.5 → +1 but
   -0.5 → -0) which was producing biased magnitudes for penalty rules.

2. baseWeight was documented as finite but not validated. NaN /
   ±Infinity propagating through the scoring sum would corrupt the
   final score for the entire account. Now throws TypeError before
   any math, mirroring the windowDays guard.

3. Negative-weight tests were inadequate (test value was already
   integral so rounding asymmetry was masked). Added a symmetric
   ±baseWeight test at quarter-window that asserts pos + neg ≈ 0
   and |pos| ≈ |neg|, locking in the no-bias property.

Plus three NIT fixes:
- "+1ms in the future" comment misnamed (the date is BEFORE the event):
  renamed variable to justBeforeEvent and corrected the comment.
- Added explicit -Infinity windowDays test (prior only covered +Infinity).
- Added boundary test "1ms before full window" that asserts the float
  return is positive — locks in the bug fix from #1 above.

Test count: 26 in this file (was 20), full suite 211/211 (was 205).
gorajing added a commit that referenced this pull request May 18, 2026
#1 Account identity: accept GitHub actor namespace
(github.com/<actor>) for v1. Do NOT build an actor->CRM resolver now
-- identity-from-actor is product logic, and a bad resolver is worse
than none (contaminates account scores). v1.5: identity layer or
operator-editable data/account-aliases.md.

#3 GitHub all-or-nothing watch entries: accept fail-loud-per-
connector for v1. 3.4's connector-level isolation means a dead repo
no longer starves the other connectors and the failure is visible
in the poll response. The half-fix (swallow per-entry failures) is
explicitly rejected.

No code change -- product calls. 3.2/3.3 NOT reworked.
gorajing added a commit that referenced this pull request May 18, 2026
…improves + nit)

BLOCKER — wrong-message attribution via MUTABLE currentRevisionId
(the user's #1 stated risk). Sequence: send rev1 → reply →
redraft to rev2 → digest attributed rev1's reply to rev2's
critique. engagement_events has no sent-revision marker. Fix:
EXCLUDE a touch whose last touch_revision was created AFTER its
first engagement event (ambiguous: which revision did the reply
answer?). The normal pre-send flow (rev1 → critic_rewrite rev2 →
SENT → events) has lastRev <= firstEvent and is correctly
INCLUDED. Conservative + honest; v1.5 sentRevisionId removes the
ambiguity. Test pins the redraft sequence is dropped from BOTH arms.

WOULD-IMPROVES:
  - bounced touches excluded from the denominator: a hard bounce
    never landed, so counting it "silent" turned a deliverability
    failure into principle evidence. ('unsubscribed' = received,
    left as observed silent for v1.) Test pinned.
  - the mixed-timestamp test was decorative (2020 vs 2026 — naive
    local parse still picked right). Replaced with a TZ-INDEPENDENT
    direct parseTs unit test (exported parseTs) asserting SQLite
    space-format == ISO-Z == Date.UTC, plus a meaningful same-day
    integration test. Now genuinely pins the codex-r1 UTC blocker.
  - exported field names passed_*/failed_* invited the "pass"
    overclaim back → renamed to noFinding_*/flagged_*
    (+ flagged_lift). Module prose updated to no-finding/flagged;
    render labels already matched.

NIT: parseTs('') → NaN is defensive (createdAt is NOT NULL from
SQLite); covered by the direct parseTs test.

Fixture correction: makeTouch now sets touch_revision.createdAt
BEFORE its engagement events (10:00 < sent 11:00 < reply 12:00) —
the redraft-ambiguity guard correctly exposed that the prior
fixture (revision defaulting to ~now, events at 2026-05-06) was a
temporally-impossible timeline.

580/580; typecheck + build + nightly-digest smoke clean.
gorajing added a commit that referenced this pull request May 18, 2026
Phase 6 is the proof/packaging phase, not a build phase. It splits
into agent-ownable (deterministic, safe) vs human-owned (judgment/
identity). This commit is the agent-ownable rails; the research,
prose, Loom, and submit remain human-owned ("do not let the system
outrank your judgment").

  - PRIVACY GATE (constraint #1; also a real plan gap — Phase 0
    never added it). .gitignore now ignores `application/*` (the
    CONTENTS glob, not the directory) so the package is private by
    default while keeping the plan's selective-publish escape hatch
    (`!application/architecture-essay.md`) workable. evidence-pack /
    outreach files stay private — they may name a hiring manager.

  - lib/application/verify.ts — pure, fails-closed pre-submit gate.
    Turns "every factual claim cites verified evidence" + "fact-check
    prose before use" from a hope into enforcement: every `ev_…` id
    cited in cover-letter.md must exist AND be `verified` in
    evidence-pack.json, else the package is rejected. Also: required
    files present, ≥1 outreach artifact, word count 500–800, and a
    cover letter citing NO evidence fails (the proof claim itself
    unbacked). Reports ALL problems at once. The evidence-id regex is
    anchored to the exact newId('evidence') shape so prose can't
    false-match (a loose pattern would launder an unbacked claim —
    the precise failure this gate prevents). It does NOT judge prose
    or whether to submit — mechanical floor only. 10 tests pin the
    fail-closed behavior (a permissive verifier is worse than none).

  - scripts/dump-evidence.ts — export VERIFIED-only evidence to the
    gitignored application/evidence-pack.json. Fails loud on bad
    usage (exit 2) / unknown account (exit 1, no garbage pack);
    warns on 0 verified rows.

  - scripts/verify-application.ts — thin IO shell over the verifier.
    Exit 0 iff the package passes every mechanical check, 1 otherwise
    with all problems listed. Gates the final
    typecheck && test && build && verify-application step. Smokes:
    no-arg→2, bad-account→1, no-package→1 (fails closed).

592/592; typecheck + build clean. NO live LLM / real-company action
taken — those are human-owned and delivered as a runbook.
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