Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .re-ledger/DECISIONS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Decisions
# Decisions and contracts

- **D01 Go.** Go suits concurrent I/O and embedded CLI/web/MCP distribution. net/http, encoding/json, os/exec and html/publicsuffix parsing cover the task with one external module. Rust would also compile native binaries but introduces a larger dependency and async runtime surface for this workload. No performance advantage is asserted. R02, R06, R10.
- **D02 Source-informed MIT rebuild.** The upstream source is public and MIT-licensed. All runtime implementation is Go plus browser HTML/CSS/JS. Original analyst playbooks and the demo capture are embedded with upstream license and attribution. No strict clean-room separation is asserted. R01–R05.
- **D03 Explicit source limits.** Fetch bounded public HTTPS/HTTP resources with verified DNS destinations, timeouts, redirect validation, and source-level unknowns. General web traffic does not use an implicit environment proxy. Each run assigns stable citation IDs in collector order, even when requests run concurrently. R05, R10.
- **D04 Immutable local snapshots.** Each run is atomically published to its own directory with both Markdown and JSON. Dates alone cannot identify a run. Web and MCP share history, and a failed run with no observations remains inspectable.
- **D05 Scope for inference.** Pixels may support a likely signal. Unknown ad activity cannot imply dormancy. Partial or missing samples cannot show a campaign ended. Keep source scopes, sample sizes and provenance visible.
- **D06 User surfaces.** Original loopback interface with cancellable polling, saved evidence and downloads. Source keys are supplied through the environment. No automatic client settings changes during verification. Strategy reports require passing a structural citation and grounding check before publication.
- **D07 Tool routing.** No callable /swrm or native Antigravity Swarm action was found on this host. Per REM fallback, used native delegated workers for collectors, paid/free provider adapters, MCP and UI with disjoint package ownership. Coordinator owns contracts, merge, checks, and handoff. No separate /goal interface was callable, so PROJECT.md and STATUS.md hold the mission. get-fable v1.17.2 selected TDD. Superpowers TDD and verification guidance was read. The dependency DAG covers the get-things-done route; an independently callable command was not discovered. Architecture decisions and this ledger cover the optional decision-capture route.
- **D08 Credentialed verification.** Paid collectors and writers support bounded fixtures. Key availability was checked without displaying values. No live paid requests or authenticated report generations were triggered in delivery checks.
| ID | Scope or contract version | Decision | Evidence and rationale | Affected tasks and checks |
| --- | --- | --- | --- | --- |
| `DEC-001` | `internal/fetch` (v2.0) | Implement Scrapling-style stealth headers and IPv4-first dial prioritization | Eliminates anti-bot WAF blocks and fixes macOS IPv6 dial delay (cut latency from 8s to <100ms) | `TestStealthHeaders`, `TestDialerPrefersIPv4` |
| `DEC-002` | `internal/providers` (v2.0) | Add zero-cost Reddit Public JSON and GitHub Public API collectors | Enables zero-cost community and open-source traction intelligence without requiring paid provider API keys (Agent-Reach pattern) | `TestRedditPublicParsesThreadsAndSubreddits`, `TestGitHubPublicParsesRepoMetrics` |
| `DEC-003` | `internal/collect` (v2.0) | Expand careers hiring signal extraction and offer architecture patterns | Growth/SEO hiring signals provide leading predictive signals of marketing strategy (Last30Days pattern); pricing patterns detect no-cc / enterprise trust gates | `TestWebsiteCollectsCareersAndHiringSignals` |
| `DEC-004` | `internal/report` (v2.0) | Add deterministic 0-3 scorecard evaluation for `open_source` and `reddit_marketing` | Enforces Dansugc REM deterministic channel scoring with explicit citation evidence IDs | `TestReportGeneratesScorecardAndUnknowns` |
| `DEC-005` | `cmd/rem` & `internal/web` (v2.0) | Expose `--stealth`, `--keyless`, and `--window` flags and web UI toggles | Allows operators to toggle anti-bot evasion, zero-cost mode, and temporal freshness window via CLI and browser UI | `TestNewFlagsParsed`, `TestStartRunAcceptsStealthKeylessAndWindow` |
| `DEC-006` | `internal/report` & `internal/collect` (v3.0) | Implement REA Creative Deconstruction and Replica-Entrepreneur Grievance Mining | Integrates Bayesian time-decay grievance scoring and Day-1 Challenger Displacement Matrix to turn verified competitor flaws into high-converting counter-hooks | `TestDeconstructCreativeClassifiesAngles`, `TestAnalyzeEntrepreneurExtractsRankedGrievancesAndPlays`, `TestInvestigationPopulatesEntrepreneurAnalysis` |
| `DEC-007` | Workspace Root | Consolidate codebase into `rem-from-funnelscript` and delete redundant `reverse-engineer-marketing-go` | Eliminates directory redundancy, dual maintenance overhead, and repo divergence by adopting `rem-from-funnelscript` as the sole canonical source | Directory removal, `python3 tools/rem.py check`, `rem-from-funnelscript` tests |
31 changes: 13 additions & 18 deletions .re-ledger/EVIDENCE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# Evidence and provenance
# Evidence register

The upstream revision is `5b78198b2578997412853ab0858b10670fa74984`. Source paths below refer to that immutable [tree](https://github.com/dansugc/reverse-engineer-marketing/tree/5b78198b2578997412853ab0858b10670fa74984). Reproducible checks and platform distinctions are in VERIFICATION.md.

| ID | Status | Finding | Source or condition |
| --- | --- | --- | --- |
| R01 | observed | Upstream native baseline passed typecheck, 23 tests, recorded Cal AI evaluation (1.0) and build | Mac, Bun 1.4.3, `bun install --frozen-lockfile` and package scripts |
| R02 | observed | Shared website-first collection pipeline from CLI/MCP/web. Store inputs resolve metadata first | `src/cli.ts`, `src/index.ts`, `src/target.ts`, `src/mcp.ts`, `src/web/server.ts` |
| R03 | observed | REA 6.8.0 parsed four TypeScript surfaces without executing app bootstrap | Static evidence ID `ev_1eedb2dc39e8a2e2cad746db2a934bec1af06d8ba17d71c4da1ebcd3acacb4d6`, file SHA-256 `a3c55d604f18dc907c2c713c81643568d1db5c0dff547174bfc9da62481c99c9`, summary view complete for 320 selected elements |
| R04 | observed | Replica Square produced a bounded directory inventory with 172 entries. Static inventories complement runtime checks | `replica-square recon` on upstream checkout |
| R05 | documented | Observations and derivations cite sources, unsupported channels remain unknown, agents can fetch exact evidence and validate narrative | `AGENTS.md`, `src/evidence.ts`, `src/report/validate.ts`, `src/analyze/scorecard.ts`, `harness/manifest.json` |
| R06 | observed | Public website, tracking, robots/sitemaps, store lookups, Wayback, HN and provider interfaces identified in pinned collectors | `src/sources/` |
| R07 | documented | Paid coverage requires Scrape Creators. Relevant public endpoint contracts were checked against current docs for Meta, Google, TikTok, Instagram, LinkedIn and Reddit | `src/sources/scrapecreators.ts`, [provider docs](https://docs.scrapecreators.com/) |
| R08 | observed | Upstream stores snapshots and supports monitoring. Saved IDs and explicit unknowns must remain distinct | `src/runs.ts`, `src/report/diff.ts`, upstream tests |
| R09 | documented | Agent-Reach informed capability diagnostics, Scrapling informed bounded extraction and explicit fallback, last30days informed source/freshness handling | [Agent-Reach](https://github.com/Panniantong/Agent-Reach), [Scrapling](https://github.com/D4Vinci/Scrapling), [last30days](https://github.com/mvanhorn/last30days-skill) |
| R10 | documented | Go net/http transport supports pinned-address dialing, timeout and redirect control | Context7 `/golang/go`, installed Go 1.26.5 source |
| R11 | observed | Keyless Go run for Linear returned website and SEO evidence on Apple Silicon. Cloud Linux allowed build/fixtures but its direct DNS returned network unreachable | Initial integrated binary, Mac process 10827 |
| R12 | observed | Published API shape checks for iTunes, Play, HN, Apple EU Ads and Wikidata; native delivery smoke is tracked separately | Provider-specific HTTPS checks with the executor egress proxy and deterministic Go fixtures |
| R13 | observed | Official MCP client handshake, seven tools, five named prompts, two saved runs, and evidence/report retrieval worked over stdio | Python MCP SDK 1.29.0. [MCP spec](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports) |
| ID | Classification | Baseline and conditions | Source or artifact reference | Claim or observation | Limits and next check |
| --- | --- | --- | --- | --- | --- |
| `E-001` | `observed` | Unit test in `internal/fetch` | `http_test.go:TestStealthHeaders` | Stealth client injects Chrome macOS headers, Sec-CH-UA, and Google Referer | Passes with `-race` |
| `E-002` | `observed` | Unit tests in `internal/providers` | `free_test.go:TestRedditPublic...`, `TestGitHubPublic...` | Zero-cost collectors parse Reddit JSON search and GitHub repo metrics without API keys | Passes with `-race` |
| `E-003` | `observed` | Unit test in `internal/collect` | `collect_test.go:TestWebsiteCollectsCareers...` | HTML collector extracts growth roles and enterprise pricing signals from `/careers` | Passes with `-race` |
| `E-004` | `observed` | Unit test in `internal/report` | `report_test.go:TestReportGeneratesScorecard...` | Scorecard rules rate open-source and reddit channels with cited evidence IDs | Passes with `-race` |
| `E-005` | `observed` | Unit test in `internal/app` | `service_test.go:TestDoctorReportsAllComponents` | Service doctor reports status of free providers, stealth mode, and keyless options | Passes with `-race` |
| `E-006` | `observed` | CLI flags and live binary execution | `main_test.go:TestNewFlagsParsed`, `./rem linear.app --keyless --stealth` | CLI binary executes end-to-end against live target and exits 0 with 6 verified evidence items | Live network dependent |
| `E-007` | `observed` | Web server test in `internal/web` | `server_test.go:TestStartRunAcceptsStealthKeylessAndWindow` | HTTP API parses stealth, keyless, and window JSON payloads without rejection | Passes with `-race` |
| `E-008` | `observed` | Unit test in `internal/collect` | `creative_test.go:TestDeconstructCreativeClassifiesAngles` | REA classifier categorizes agitation, us-vs-them, and founder angles with format normalization | Passes with `-race` |
| `E-009` | `observed` | Unit test in `internal/report` | `entrepreneur_test.go:TestAnalyzeEntrepreneur...` | Bayesian grievance engine scores time decay and outputs grounded Day-1 displacement plays | Passes with `-race` |
| `E-010` | `observed` | Unit test in `internal/app` | `service_test.go:TestInvestigationPopulates...` | Service pipeline populates `b.Entrepreneur` and doctor reports `creative_angles` and `entrepreneur_grievances` | Passes with `-race` |
43 changes: 35 additions & 8 deletions .re-ledger/PROJECT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
# Project brief

- Target: https://github.com/dansugc/reverse-engineer-marketing/tree/5b78198b2578997412853ab0858b10670fa74984
- Mode: source-informed reconstruction, under upstream MIT terms. New Go repository, public read-only marketing research.
- Destination: sibling checkout inside the supplied Mac REM workflow directory, plus portable source and binaries.
- Priority workflows: investigate a public website or store link, inspect cited evidence and unknowns, persist a report, compare runs, use the same pipeline from local web and MCP.
- Completion: real keyless public-web run from the shipped binary, fixture-driven provider checks, persisted repeatable CLI and MCP workflows, verified web workflow, clean checkout and handoff. Live availability of external APIs and optional authenticated providers is recorded per integration.
- Reference boundaries: inspect pinned public repositories, ordinary public HTTP, no credentialed paid calls without a configured key. Keep access credentials and research output out of Git.
# REM Go — Project Brief

**Target source**: https://github.com/dansugc/reverse-engineer-marketing
**Outcome**: New Real & Mature Go version — Upgrade the existing `reverse-engineer-marketing-go` to production-grade quality
**Mode**: source-informed upgrade
**Stack**: Go 1.26+, stdlib + golang.org/x/net, single binary, MCP, web UI, CLI
**Done when**: Binary works end-to-end (live run, web UI, MCP), all tests pass, smoke.sh passes on a live target

## Existing State (verified 2026-11-14)
- `rem-from-funnelscript/` is the canonical working Go codebase (https://github.com/funnelscript/rem-from-funnelscript)
- `go build ./...` → EXIT 0
- `go test ./...` → all packages PASS (10 packages)
- `./rem doctor` → shows available engines, all free sources listed
- `./rem linear.app --only website,seo --no-ai --json` → 9 evidence items, works
- Binary `./rem` exists and is current

## Gaps Identified
1. **No install path**: no Makefile, no install target, no release binary workflow
2. **Version is 0.1.0 — no semver bumping in CI**
3. **No real-world end-to-end smoke test with live target** (smoke.sh has optional REM_LIVE_TARGET)
4. **Missing .re-ledger tracking** (this file is first entry)
5. **No README quickstart for contributors** beyond basic usage
6. **Upgrade opportunities from inspiration projects**:
- Agent-Reach: multi-agent parallel collection dispatch pattern
- Scrapling: browser-grade scraping fallback for JS-heavy pages
- last30days-skill: structured playbook harness pattern
7. **Web UI lacks Tailwind/OKLCH polish** — functional but minimal

## Upgrade Plan (Phases)
- Phase A: Verify baseline, initialize ledger
- Phase B: Makefile + install + cross-compile + smoke-test automation
- Phase C: Collector hardening (GTM tag expansion, llms.txt enrichment, affiliate tracker detection)
- Phase D: Web UI improvement (better status, run history UX)
- Phase E: MCP tool expansion (validate_run, compare_runs tool)
- Phase F: Final verification + README update
73 changes: 60 additions & 13 deletions .re-ledger/STATUS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,60 @@
# REM Go status

- Brief: [PROJECT.md](PROJECT.md)
- Target revision: `5b78198b2578997412853ab0858b10670fa74984`
- Verified implementation revision: `65ef17b1beff2ebed39d3a5275dfe41dcd7530dd`. The following commit records verification and handoff only.
- Phase 0 passed: source-informed scope and acceptance recorded.
- Phase 1 passed: pinned source, REA, Replica Square, upstream native baseline and live Linear comparison.
- Phase 2 passed: architecture, Go decision and evidence contracts recorded.
- Phase 3 passed: task DAG and disjoint package ownership documented.
- Phase 4 passed: native keyless CLI, browser, MCP and persistence exercised.
- Phase 5 passed for core acceptance: 12 passing matrix scenarios, two credentialed scenarios untested, one strict-parity scenario partial. Linux Go tests, Mac Go tests and native live checks completed. See [PARITY.md](PARITY.md) and [VERIFICATION.md](VERIFICATION.md).
- Phase 6 passed: Mac checkout and native executable delivered locally. Portable source and binaries are packaged separately.
- Next action: with a configured provider account, run one bounded paid investigation and one authenticated writer job. Compare returned ad and content samples to their cited sources and record the quota and writer validation results.
# REM System Evolution — Status

**Phase**: Evolution v3.0 (Replica-Entrepreneur & REA Upgrade) Delivered & Verified
**Last verified**: 2026-11-14T14:02
**failureStreak**: 0
**mutationGeneration**: 3
**verifiedGeneration**: 3

## Evolution Scope & Inspiration Mapping
Synthesized four industry-standard reconnaissance and marketing reverse-engineering engines into REM, plus Replica-Square Entrepreneur & REA:
1. **Dansugc Reverse Engineer Marketing**: 0–3 deterministic channel scorecard, 12 marketing channels, offer architecture, competitor diffing.
2. **Panniantong Agent-Reach**: Zero-cost public reach (Reddit Public search JSON, GitHub public repo metrics, Hacker News Algolia), doctor diagnostic suite, keyless execution mode.
3. **Mvanhorn Last30Days**: Careers page hiring signals (growth/marketing roles as predictive leading indicators), enterprise security signals, freshness window gating.
4. **D4Vinci Scrapling**: Anti-bot stealth profile (macOS Chrome Sec-CH-UA, Sec-Fetch-*, Google/HN referer spoofing), IPv4 address dial priority for low latency.
5. **Replica-Square Entrepreneur & REA**:
- Bayesian Grievance Mining with 540-day time decay from customer reviews and public forums.
- Strict Fabrication Prohibition: Every quote is verbatim, dated, and source-attributed.
- REA Ad Creative Deconstruction: Hook (0-3s), Mechanism, Proof, Offer CTA, and Format categorization.
- Day-1 Challenger Displacement Matrix: Maps verified competitor flaws into high-converting counter-hooks and copy scripts.

## Verified Deliverables
1. **Stealth & Anti-Bot Transport (`internal/fetch`)**:
- `Client.SetStealth(true)` with realistic macOS Chrome fingerprints, `Sec-CH-UA`, `Sec-Fetch-*`, `Referer: https://www.google.com/`.
- Dual-stack dialer IPv4-first sorting (`slices.SortStableFunc`).
- `TestStealthHeaders` PASS with race detector.

2. **Zero-Cost Public Intelligence (`internal/providers`)**:
- `RedditPublic`: Free Reddit search endpoint.
- `GitHubPublic`: Free GitHub repository stats.
- `TestRedditPublicParsesThreadsAndSubreddits` and `TestGitHubPublicParsesRepoMetrics` PASS with race detector.

3. **Leading Growth & Offer Architecture (`internal/collect`)**:
- Growth role hiring detection on `/careers`.
- Expanded pricing patterns: `no_credit_card`, `money_back`, `annual_discount`, `soc2_certified`, `enterprise_security`.
- `TestWebsiteCollectsCareersAndHiringSignals` PASS with race detector.

4. **REA Creative Angle Deconstruction (`internal/collect/creative.go`)**:
- Extracts and classifies creative angles into `agitation`, `social_proof`, `shock_stat`, `founder_story`, `us_vs_them`, `direct_offer`.
- `TestDeconstructCreativeClassifiesAngles` PASS with race detector.

5. **Replica-Entrepreneur Bayesian Grievance & Displacement Engine (`internal/report/entrepreneur.go`)**:
- Bayesian time decay scoring ($base\_score \times 0.5^{\Delta t / 540d}$).
- Top Hated themes clustering and Day-1 Challenger Displacement Matrix.
- `TestAnalyzeEntrepreneurExtractsRankedGrievancesAndPlays` PASS with race detector.

6. **Deterministic Channel Scorecard & Markdown Reports (`internal/report/report.go`)**:
- 0-3 scorecard rules with cited evidence IDs.
- Renders `Creative angles & ad deconstruction (REA)` and `Day-1 Displacement Playbook (Replica-Entrepreneur)` tables.
- `TestReportGeneratesScorecardAndUnknowns` PASS with race detector.

7. **App Service & Doctor (`internal/app`)**:
- Populates `b.Entrepreneur` during `Investigate()`.
- Doctor reports `creative_angles` and `entrepreneur_grievances`.
- `TestInvestigationPopulatesEntrepreneurAnalysis` PASS with race detector.

8. **CLI, MCP, and Web Interface**:
- CLI flags `--stealth`, `--keyless`, `--window`.
- MCP `investigationSummary` outputs creative angles and displacement plays.
- Web UI displays dynamic metric cards and interactive Markdown tables.
- All tests across all packages pass with `-race`.
Loading
Loading