mirror of
https://github.com/dansugc/reverse-engineer-marketing.git
synced 2026-11-15 20:18:47 +01:00
- engines.ts: Claude Code headless (stream-json, no tools, no MCP/hooks, API keys stripped so the subscription is used), Codex exec (read-only, user config ignored), Anthropic API, evidence-only - web server on 127.0.0.1 with Host/Origin guard, SSE progress, run history, Scrape Creators key settings saved to ~/.config (0600) - single-file UI: live stage progress, scorecard, streaming report, clickable evidence citations, copy/download Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Repository guidelines
REM (Reverse Engineer Marketing) collects public evidence of how a company acquires customers and turns it into an evidence-cited report. CLI and MCP share one pipeline (src/index.ts).
Evidence contract
- Collectors (
src/sources/*) add observations (seen at a URL/API) or derivations (computed from observations) to theEvidenceStore. They never write conclusions ("they scale with UGC"): that's the report's job. - Anything not checked, blocked, or unavailable becomes an Unknown with a reason and, where possible, a
manualCheckURL. Unknown is never "none". - A negative needs a negative observation (e.g. ad library checked and empty).
- Keep evidence compact: clip long text (
clip()), cap arrays, and keep the fields an analyst would quote (hooks, ad copy, dates, URLs).
Layout
src/sources/collectors (one area each). Pure parsing lives inhtml.ts,seo.ts,tracking.tsand is unit-tested.src/analyze/scorecard.tsdeterministic channel scorecard (no LLM). Every row cites evidence ids.src/analyze/synthesize.tsClaude report from bundle + harness.src/report/deterministic Markdown + the validator (validate.ts) used by evals and thevalidate_reporttool.harness/versioned analyst bundle (role, guardrails, template, lessons, playbooks). Listed inmanifest.json; the loader fails if a file is missing and hashes the bundle into every report.evals/recorded evidence fixtures +run.ts.src/engines.tsreport writers: Claude Code (claude -pstream-json), Codex (codex exec --json), Anthropic API. Subscription engines must never inherit API-key env vars.src/web/server.ts+web/index.htmllocal web app (rem web): no framework, SSE job events, 127.0.0.1 + Host/Origin guard.src/runs.tsstores runs for web + MCP.
Changing the harness
- Edit a playbook / lesson / guardrail. Bump
harness/manifest.jsonversionfor behavior changes. npm run eval -- --liveand compareevals/results.jsonlagainst the previous SHA.- Add a lesson (cue → lesson) when a review shows a recurring miss.
Paid APIs
Scrape Creators calls go through ScrapeCreators.get (budgeted + 24h cache). Ask sc.can(n) before optional calls. Verify response shapes against a live call before relying on a field and read fields defensively.
Checks
npm run typecheck && npm test && npm run eval before a PR. Don't commit rem-reports/, keys, or dist/.