@agent-pattern-labs/leads-rig 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.claude/agents/general-free.md +39 -0
  2. package/.claude/agents/general-paid.md +20 -0
  3. package/.claude/agents/glm-minimal.md +9 -0
  4. package/.claude/iso-route.resolved.json +21 -0
  5. package/.claude/settings.json +3 -0
  6. package/.codex/config.toml +24 -0
  7. package/.cursor/iso-route.md +17 -0
  8. package/.cursor/mcp.json +19 -0
  9. package/.cursor/rules/agent-general-free.mdc +38 -0
  10. package/.cursor/rules/agent-general-paid.mdc +19 -0
  11. package/.cursor/rules/agent-glm-minimal.mdc +8 -0
  12. package/.cursor/rules/main.mdc +61 -0
  13. package/.mcp.json +19 -0
  14. package/.opencode/agents/general-free.md +48 -0
  15. package/.opencode/agents/general-paid.md +29 -0
  16. package/.opencode/agents/glm-minimal.md +19 -0
  17. package/.opencode/instructions.md +3 -0
  18. package/.opencode/skills/lead-harness.md +56 -0
  19. package/.opencode/skills/public-leads.md +56 -0
  20. package/.pi/prompts/lead-harness.md +54 -0
  21. package/.pi/prompts/public-leads.md +54 -0
  22. package/.pi/skills/general-free/SKILL.md +38 -0
  23. package/.pi/skills/general-paid/SKILL.md +19 -0
  24. package/.pi/skills/glm-minimal/SKILL.md +8 -0
  25. package/AGENTS.md +56 -0
  26. package/CLAUDE.md +56 -0
  27. package/LICENSE +21 -0
  28. package/README.md +61 -0
  29. package/batch/README.md +37 -0
  30. package/batch/batch-prompt.md +19 -0
  31. package/batch/batch-runner.sh +18 -0
  32. package/bin/create-leads-harness.mjs +178 -0
  33. package/bin/lead-harness.mjs +201 -0
  34. package/bin/sync.mjs +150 -0
  35. package/config/profile.example.yml +34 -0
  36. package/docs/ARCHITECTURE.md +85 -0
  37. package/docs/CONSTRUCTION.md +40 -0
  38. package/docs/README.md +5 -0
  39. package/docs/SETUP.md +89 -0
  40. package/examples/README.md +9 -0
  41. package/examples/sample-leads.json +57 -0
  42. package/iso/agents/general-free.md +50 -0
  43. package/iso/agents/general-paid.md +31 -0
  44. package/iso/agents/glm-minimal.md +21 -0
  45. package/iso/commands/lead-harness.md +59 -0
  46. package/iso/commands/public-leads.md +59 -0
  47. package/iso/config.json +11 -0
  48. package/iso/instructions.md +56 -0
  49. package/iso/instructions.opencode.md +3 -0
  50. package/iso/mcp.json +16 -0
  51. package/lib/leadharness-crawler.mjs +911 -0
  52. package/lib/leadharness-ingest.mjs +157 -0
  53. package/lib/leadharness-leads.mjs +574 -0
  54. package/models.yaml +32 -0
  55. package/modes/_shared.md +50 -0
  56. package/modes/batch.md +34 -0
  57. package/modes/crawl.md +25 -0
  58. package/modes/ingest.md +33 -0
  59. package/modes/pipeline.md +27 -0
  60. package/modes/reference-local-helpers.md +13 -0
  61. package/modes/review.md +15 -0
  62. package/modes/setup.md +25 -0
  63. package/opencode.json +43 -0
  64. package/package.json +186 -0
  65. package/scripts/batch-orchestrator.mjs +558 -0
  66. package/scripts/crawl.mjs +129 -0
  67. package/scripts/ingest.mjs +48 -0
  68. package/scripts/manifest.mjs +71 -0
  69. package/scripts/pipeline.mjs +118 -0
  70. package/scripts/validate-leads.mjs +69 -0
  71. package/templates/canon.json +26 -0
  72. package/templates/capabilities.json +23 -0
  73. package/templates/context.json +20 -0
  74. package/templates/contracts.json +72 -0
  75. package/templates/facts.json +13 -0
  76. package/templates/index.json +13 -0
  77. package/templates/lead-schema.json +143 -0
  78. package/templates/lineage.json +10 -0
  79. package/templates/migrations.json +4 -0
  80. package/templates/postflight.json +11 -0
  81. package/templates/preflight.json +19 -0
  82. package/templates/prioritize.json +10 -0
  83. package/templates/redact.json +15 -0
  84. package/templates/score.json +18 -0
  85. package/templates/states.yml +25 -0
  86. package/templates/timeline.json +10 -0
  87. package/verify-pipeline.mjs +123 -0
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: Procedural lead-crawl worker for public-web extraction, JSON artifact creation, validation, manifest updates, and ingest retries.
3
+ role: fast
4
+ targets:
5
+ opencode:
6
+ mode: subagent
7
+ temperature: 0.1
8
+ reasoningEffort: minimal
9
+ tools:
10
+ geometra_connect: true
11
+ geometra_page_model: true
12
+ geometra_run_actions: true
13
+ geometra_list_sessions: true
14
+ geometra_disconnect: true
15
+ task: false
16
+ ---
17
+
18
+ You are the @general-free subagent. The orchestrator delegated procedural lead-discovery work to you: bounded public-page crawling, structured extraction, validation, and local artifact updates.
19
+
20
+ ## Browser Preflight
21
+
22
+ If your task uses Geometra, start with:
23
+
24
+ ```
25
+ geometra_list_sessions()
26
+ geometra_disconnect({ closeBrowser: true })
27
+ geometra_connect({
28
+ pageUrl: "<the assigned URL>",
29
+ isolated: true,
30
+ headless: true,
31
+ slowMo: 250,
32
+ stealth: true
33
+ })
34
+ ```
35
+
36
+ Skip this only if the task explicitly says to attach to an existing session.
37
+
38
+ ## Do
39
+
40
+ - Crawl only public, high-signal company pages.
41
+ - Extract emails, role inboxes, contact forms, public names/titles, source URL, evidence, and warnings.
42
+ - Emit JSON/JSONL matching `templates/lead-schema.json`.
43
+ - Run `npx public-leads validate --input <file>` before returning a result.
44
+ - Return file paths and terminal status, not a prose-only summary.
45
+
46
+ ## Do Not
47
+
48
+ - Guess email patterns, scrape private/authenticated pages, send outreach, or invent source evidence.
49
+ - Spawn or check other tasks.
50
+ - Paste secrets from config or environment.
@@ -0,0 +1,31 @@
1
+ ---
2
+ description: Quality-sensitive lead research worker for ICP fit, company context, and nuanced review notes.
3
+ role: quality
4
+ targets:
5
+ opencode:
6
+ mode: subagent
7
+ temperature: 0.3
8
+ reasoningEffort: medium
9
+ tools:
10
+ geometra_connect: true
11
+ geometra_page_model: true
12
+ geometra_run_actions: true
13
+ geometra_list_sessions: true
14
+ geometra_disconnect: true
15
+ task: false
16
+ ---
17
+
18
+ You are the @general-paid subagent. Use judgment for ICP fit, lead quality review, company context, and evidence quality. Keep final outputs tied to source URLs and local artifacts.
19
+
20
+ ## Do
21
+
22
+ - Research target-company context when the orchestrator requests quality review.
23
+ - Explain why a lead is high/medium/low value using evidence already captured in artifacts.
24
+ - Improve source-backed evidence snippets without fabricating facts.
25
+ - Validate any edited artifact with `npx public-leads validate --input <file>`.
26
+
27
+ ## Do Not
28
+
29
+ - Replace deterministic validation with prose.
30
+ - Send outreach or generate cold emails unless the user explicitly asks for copy outside the crawl workflow.
31
+ - Spawn or check other tasks.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Narrow JSON extractor for small lead snippets and schema transforms. Not for multi-step crawling.
3
+ role: minimal
4
+ targets:
5
+ opencode:
6
+ mode: subagent
7
+ temperature: 0
8
+ reasoningEffort: none
9
+ tools:
10
+ geometra_*: false
11
+ bash: false
12
+ write: false
13
+ edit: false
14
+ webfetch: false
15
+ websearch: false
16
+ task: false
17
+ ---
18
+
19
+ You are the @glm-minimal subagent. Return the requested small structured output only.
20
+
21
+ If the orchestrator asks for JSON, return JSON without markdown fences. If you cannot complete the transform, return `{"error":"<one-sentence reason>"}`.
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Legacy alias for the public-leads command center.
3
+ user_invocable: true
4
+ args: mode
5
+ targets:
6
+ claude: skip
7
+ cursor: skip
8
+ codex: skip
9
+ ---
10
+
11
+ # lead-harness -- Legacy Alias
12
+
13
+ ## Mode Routing
14
+
15
+ Determine the mode from `{{mode}}`:
16
+
17
+ | Input | Mode |
18
+ |---|---|
19
+ | empty/no args | discovery |
20
+ | `setup` | setup |
21
+ | `crawl` | crawl |
22
+ | `pipeline` | pipeline |
23
+ | `batch` | batch |
24
+ | `ingest` | ingest |
25
+ | `review` | review |
26
+ | domain list or lead request | pipeline |
27
+
28
+ If the input is a domain, URL, or pasted domain list, run `pipeline`.
29
+
30
+ ## Discovery
31
+
32
+ Show this menu:
33
+
34
+ ```
35
+ public-leads -- Command Center
36
+
37
+ Available commands:
38
+ /public-leads setup -> Create/check config and domain input files
39
+ /public-leads crawl -> Crawl one or more assigned domains
40
+ /public-leads pipeline -> Process data/pipeline.md or data/domains.tsv
41
+ /public-leads batch -> Run batch/batch-runner.sh
42
+ /public-leads ingest -> Submit validated leads to the configured ingest API
43
+ /public-leads review -> Inspect lead artifacts and ingest state
44
+
45
+ Local commands:
46
+ npx public-leads crawl --input data/domains.tsv --out data/lead-results.json
47
+ npx public-leads pipeline --input data/domains.tsv --ingest --target-project /path/to/cold-agent-leads
48
+ npx public-leads validate --input data/lead-results.json
49
+ npx public-leads manifest --input data/lead-results.json
50
+ npx public-leads ingest --input data/lead-results.json --target-project /path/to/cold-agent-leads
51
+ npx public-leads verify
52
+ ```
53
+
54
+ ## Load Context
55
+
56
+ Read `modes/_shared.md` plus `modes/{mode}.md` for `crawl`, `pipeline`, `batch`, and `ingest`.
57
+ Read only `modes/{mode}.md` for `setup` and `review`.
58
+
59
+ Execute the selected mode exactly.
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Lead discovery command center -- crawl domains, validate artifacts, and ingest batches into a configured API.
3
+ user_invocable: true
4
+ args: mode
5
+ targets:
6
+ claude: skip
7
+ cursor: skip
8
+ codex: skip
9
+ ---
10
+
11
+ # public-leads -- Router
12
+
13
+ ## Mode Routing
14
+
15
+ Determine the mode from `{{mode}}`:
16
+
17
+ | Input | Mode |
18
+ |---|---|
19
+ | empty/no args | discovery |
20
+ | `setup` | setup |
21
+ | `crawl` | crawl |
22
+ | `pipeline` | pipeline |
23
+ | `batch` | batch |
24
+ | `ingest` | ingest |
25
+ | `review` | review |
26
+ | domain list or lead request | pipeline |
27
+
28
+ If the input is a domain, URL, or pasted domain list, run `pipeline`.
29
+
30
+ ## Discovery
31
+
32
+ Show this menu:
33
+
34
+ ```
35
+ public-leads -- Command Center
36
+
37
+ Available commands:
38
+ /public-leads setup -> Create/check config and domain input files
39
+ /public-leads crawl -> Crawl one or more assigned domains
40
+ /public-leads pipeline -> Process data/pipeline.md or data/domains.tsv
41
+ /public-leads batch -> Run batch/batch-runner.sh
42
+ /public-leads ingest -> Submit validated leads to the configured ingest API
43
+ /public-leads review -> Inspect lead artifacts and ingest state
44
+
45
+ Local commands:
46
+ npx public-leads crawl --input data/domains.tsv --out data/lead-results.json
47
+ npx public-leads pipeline --input data/domains.tsv --ingest --target-project /path/to/cold-agent-leads
48
+ npx public-leads validate --input data/lead-results.json
49
+ npx public-leads manifest --input data/lead-results.json
50
+ npx public-leads ingest --input data/lead-results.json --target-project /path/to/cold-agent-leads
51
+ npx public-leads verify
52
+ ```
53
+
54
+ ## Load Context
55
+
56
+ Read `modes/_shared.md` plus `modes/{mode}.md` for `crawl`, `pipeline`, `batch`, and `ingest`.
57
+ Read only `modes/{mode}.md` for `setup` and `review`.
58
+
59
+ Execute the selected mode exactly.
@@ -0,0 +1,11 @@
1
+ {
2
+ "targets": {
3
+ "opencode": {
4
+ "instructions": [
5
+ "templates/lead-schema.json",
6
+ "templates/states.yml"
7
+ ],
8
+ "small_model": "opencode-go/deepseek-v4-flash"
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,56 @@
1
+ # Agent: public-leads-harness
2
+
3
+ Agentic public-web lead discovery harness. It crawls company domains, extracts reviewable public-source contacts, validates artifacts against the local ingest contract, and can submit completed batches to a configured ingest API.
4
+
5
+ ## Hard Limits
6
+
7
+ - [H1] Only collect public-source business contact data. Do not infer, guess, brute-force, or enrich private email addresses. Every lead needs a source URL and evidence excerpt.
8
+ - [H2] Respect robots.txt, terms, rate limits, and site intent. If a page blocks crawling or is not public, record a warning and move on.
9
+ - [H3] Never send outreach from this harness. The output is reviewable lead records and ingest-ready artifacts, not email campaigns.
10
+ - [H4] Use file-backed artifacts before ingest. A subagent prose summary is not enough; write validated JSON/JSONL first, then ingest.
11
+ - [H5] Do not paste API tokens, proxy credentials, or cookies into task prompts or summaries. Reference `config/profile.yml` or environment variables by name only.
12
+ - [H6] For batch domain crawling, dispatch at most 2 subagents per round and wait for final artifact paths before launching the next round.
13
+ - [H7] Before using browser/MCP crawling in a batch round, run Geometra cleanup: `geometra_list_sessions()` then `geometra_disconnect({ closeBrowser: true })`.
14
+
15
+ ## Defaults
16
+
17
+ - [D1] Use `@general-free` for procedural crawl/extract/validate work, `@general-paid` for quality-sensitive ICP research and lead-fit reasoning, and `@glm-minimal` for narrow JSON transforms.
18
+ - [D2] Use deterministic local helpers when they can validate, normalize, manifest, preflight, postflight, or ingest artifacts.
19
+ - [D3] Read the active mode file before executing. Mode files own output shapes and gates.
20
+ - [D4] Prefer official company websites and high-signal pages: home, contact, about, team, leadership, people, press, blog, careers, and legal pages.
21
+ - [D5] Keep artifacts source-backed. Every emitted lead should include `domain`, `sourceUrl`, `evidence`, `emailType`, `extractionMethod`, `verificationStatus`, and `confidence`.
22
+
23
+ ## Procedure
24
+
25
+ 1. Check for `config/profile.yml` and `data/domains.tsv` or `data/pipeline.md`; onboard if missing.
26
+ 2. Pick and name the mode from Routing. If no mode fits, ask.
27
+ 3. Read `modes/_shared.md` plus `modes/{mode}.md` unless the mode says otherwise.
28
+ 4. Normalize domains and dedupe against prior artifacts.
29
+ 5. Crawl bounded, public pages only. Preserve warnings and page visits.
30
+ 6. Validate lead artifacts with `npx public-leads validate`.
31
+ 7. Create or update the manifest with `npx public-leads manifest`.
32
+ 8. Ingest only validated payloads with `npx public-leads ingest`.
33
+ 9. Run `npx public-leads verify` before ending a batch workflow.
34
+
35
+ ## Routing
36
+
37
+ | If the user... | Mode |
38
+ |---|---|
39
+ | wants to crawl domains | `crawl` |
40
+ | gives a domain list or asks for leads | `pipeline` |
41
+ | asks to submit/store leads | `ingest` |
42
+ | asks to inspect lead state | `review` |
43
+ | asks for batch processing | `batch` |
44
+ | asks for setup | `setup` |
45
+ | otherwise | Ask which mode fits |
46
+
47
+ ## Output
48
+
49
+ Output shape is mode-specific. Keep user-facing status terse and ground claims in files, command output, or ingest responses.
50
+
51
+ ## Reference
52
+
53
+ - `modes/{mode}.md` for active workflow instructions.
54
+ - `templates/lead-schema.json` for the lead artifact contract.
55
+ - `templates/states.yml` for canonical run and ingest states.
56
+ - `docs/ARCHITECTURE.md` for harness architecture.
@@ -0,0 +1,3 @@
1
+ # OpenCode Addendum
2
+
3
+ Use `/public-leads <mode>` as the command router. Keep the root orchestrator focused on planning, file-backed validation, and bounded dispatch; tool-heavy crawling belongs in subagents when processing multiple domains.
package/iso/mcp.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "servers": {
3
+ "geometra": {
4
+ "command": "npx",
5
+ "args": ["-y", "@geometra/mcp@1.61.3"]
6
+ },
7
+ "state-trace": {
8
+ "command": "state-trace-mcp",
9
+ "env": {
10
+ "STATE_TRACE_STORAGE_PATH": ".state-trace/memory.db",
11
+ "STATE_TRACE_NAMESPACE": "public-leads-harness",
12
+ "STATE_TRACE_CAPACITY_LIMIT": "256"
13
+ }
14
+ }
15
+ }
16
+ }