1---2name: oma-market3description: Market research skill for pain-point extraction, trend detection, competitor positioning, and discovery across community sources (Reddit, X, YouTube, TikTok, HN, Polymarket, GitHub, arXiv, Techmeme, Bluesky, web and more). Delegates research to the always-latest mvanhorn/last30days engine via `oma market run`, adds oma's detect-trap preflight, intent-auto SWOT / Porter's 5F / PESTEL framing, and a single LAW-compliant brief. Use for market research, pain point analysis, trend detection, competitor research, user complaints, voice-of-customer, 시장조사, 사용자 페인, 트렌드, 경쟁구도.4---5
6# Market Research Agent - Community Signal Intelligence
7
8## Scheduling
9
10### Goal
11Run the upstream `last30days` research engine (always the latest release, managed by oma) for community-signal research, then frame the result for the user's intent (pain / trend / competitor / discovery) with strategic frameworks and save one brief under `.agents/results/market/`.
12
13### Intent signature
14- User asks about pain points, user complaints, or voice-of-customer signals for a product or category.
15- User asks what is trending, growing, or declining in a space this week or month.
16- User asks how one product compares to another in community sentiment or positioning.
17- User asks for discovery or exploratory market research on a topic, a person, a company, or a ticker.
18
19### When to use
20- Extracting real user pain points from community posts (Reddit with real upvotes and top comments, HN, X, Bluesky, GitHub Issues)
21- Detecting trends in a category over a window (`--days 7|30|90|180`)
22- Competitor sentiment analysis and SWOT / Porter's 5F positioning
23- Open-ended discovery research (`--discover`), person mode, hiring signals (`--hiring-signals`), follow-up drills (`--drill`)
24
25### When NOT to use
26- General web research without market framing -> use oma-search directly
27- Academic literature -> use oma-scholar
28- Live dashboards or scheduled monitoring -> `oma schedule <action>` wrapping this skill
29
30### Expected inputs
31- Topic string; optional `--intent pain|trend|competitor|discovery` (else classified per `resources/intent-rules.md`)
32- Optional window (`--days`), `--vs <entity>` (competitor), `--frameworks auto|none|swot,5f,pestel`
33- Any native last30days flag (see `oma market run --help`) — passed through verbatim
34
35### Expected outputs
36- Single markdown brief at `.agents/results/market/{topic-slug}-{YYYYMMDD}.md`
37- First line: the engine's badge (`🌐 last30days v{VERSION} · synced {date}`); body per the upstream OUTPUT CONTRACT; framework sections appended per intent; engine footer preserved
38- Raw engine artifacts under `market.save_dir` (default `.agents/results/market/raw/`)
39
40```yaml
41outputs:
42 - name: market-brief
43 description: Single LAW-compliant markdown brief with framework sections
44 artifact: ".agents/results/market/*.md"
45 required: true
46```
47
48### Dependencies
49- `oma market resolve` / `oma market run` — engine location, Python 3.12+ resolution, `--save-dir` default
50- The upstream `SKILL.md` at the resolved engine root (`skillMd` in `oma market resolve --json`) — the authoritative research contract
51- `resources/intent-rules.md`, `resources/frameworks/`, `resources/output-laws.md`, `resources/execution-protocol.md`
52
53### Control-flow features
54- `oma market detect-trap` gate before anything else (exit 2 = REFUSE, exit 4 = invalid)
55- Engine is always the latest release: `oma market resolve` refreshes the managed copy (throttled) and falls back to the cached copy offline; a pinned `market.path` / `LAST30DAYS_HOME` opts out
56- Sources needing keys/cookies auto-skip inside the engine; keyless sources (Reddit, HN, GitHub, Polymarket, arXiv, Techmeme, Digg, web) always run
57- Framework auto-toggle by intent (pain/trend → SWOT; competitor → SWOT + Porter's 5F; discovery → SWOT + PESTEL)
58
59## Structural Flow
60
61### Entry
621. Run `oma market detect-trap "<topic>"`. Exit 2 → surface the REFUSE reason and reframe suggestion, stop.
632. Run `oma market resolve --json`. `ok: false` → report `reason` (missing engine → `oma market update`; missing Python → the install hint) and stop. Never fall back to WebSearch-only synthesis and present it as market research.
643. Read the upstream contract at `engine.skillMd` **top to bottom**. It is long by design; do not skim. Treat `engine.root` as its `SKILL_DIR`.
654. Classify intent per `resources/intent-rules.md`; map to engine flags and framework set.
66
67### Scenes
681. **PREPARE**: detect-trap, resolve, read upstream SKILL.md, classify intent.
692. **UPSTREAM STEPS**: follow the upstream SKILL.md exactly — Step 0 (first-run setup wizard, consent-driven), intent parsing, Step 0.45 (its own query-quality preflight), Step 0.5 / 0.55 (handle, subreddit, hashtag resolution when WebSearch is available), Step 0.75 (query plan). Skip only its "Runtime Preflight" Python-hunt block: `oma market run` already resolved the interpreter.
703. **RUN**: wherever the upstream contract says `"${LAST30DAYS_PYTHON}" "${SKILL_DIR}/scripts/last30days.py" <args>`, run `oma market run <args>` with the **same arguments** (foreground, 5-minute timeout, `--emit=compact`). `--save-dir` is added automatically from `market.save_dir` unless you pass one.
714. **SYNTHESIZE**: produce the brief exactly as the upstream OUTPUT CONTRACT dictates (badge first line, Ranked Evidence Clusters, LAWs). Then append the framework sections selected for the intent, using only clusters present in the engine output as evidence (`resources/frameworks/`).
725. **FINALIZE**: run the self-check in `resources/output-laws.md`, write `.agents/results/market/{topic-slug}-{YYYYMMDD}.md`, preview the first 50 lines.
73
74### Transitions
75- `--vs <entity>` or "A vs B" phrasing → competitor intent → upstream COMPARISON flow (two passes + head-to-head as its contract specifies) → SWOT + Porter's 5F.
76- Person / company / ticker topics → upstream person / hiring-signals / StockTwits handling applies unchanged.
77- `engine.status: stale` → include the `note` in the report (research ran on the cached engine version).
78
79### Failure and recovery
80- detect-trap exit 2 → REFUSE; do not run the engine; `--force` only on explicit user reconfirmation.
81- `oma market resolve` not ok → stop with the reason; no engine run.
82- Engine non-zero exit → report stderr verbatim; do not synthesize from partial stdout unless the upstream contract says the emitted compact output is still valid.
83- Upstream Python-version gate / setup wizard messages → relay to the user exactly as the upstream contract instructs.
84
85### Exit
86- Success: brief written with badge, clusters, frameworks, and engine footer; path reported.
87- Partial: engine ran with skipped sources (footer lists them) — say so; never pad with invented evidence.
88
89## Logical Operations
90
91### Actions
92| Action | SSL primitive | Evidence |
93|--------|---------------|----------|
94| detect-trap preflight | `VALIDATE` | Topic arg, trap pattern rules |
95| Resolve engine + Python | `CALL_TOOL` | `oma market resolve --json` |
96| Read upstream contract | `READ` | `engine.skillMd` |
97| Classify intent | `SELECT` | `resources/intent-rules.md` |
98| Upstream pre-research steps | `INFER` | Upstream SKILL.md Steps 0–0.75 |
99| Run engine | `CALL_TOOL` | `oma market run <args>` |
100| Synthesize + frameworks | `WRITE` | Upstream OUTPUT CONTRACT, `resources/frameworks/` |
101| Self-check + write brief | `WRITE` | `resources/output-laws.md`, `.agents/results/market/` |
102
103### Tools and instruments
104- `oma market detect-trap <topic>` (preflight gate)
105- `oma market resolve [--refresh|--offline] [--json]` (engine + Python resolution; managed latest)
106- `oma market update` (force-refresh the managed engine)
107- `oma market run <engine args…>` (passthrough to `scripts/last30days.py`)
108
109### Canonical command path
110```bash
111TOPIC="VS Code pain points"
112oma market detect-trap "$TOPIC"
113oma market resolve --json # read .engine.skillMd, then follow it
114# … upstream Steps 0 / 0.45 / 0.5 / 0.55 / 0.75 …
115oma market run "$TOPIC" --plan "$QUERY_PLAN_FILE" --subreddits=vscode --emit=compact --save-suffix=v3
116```
117
118### Resource scope
119| Scope | Resource target |
120|-------|-----------------|
121| `NETWORK` | Inside the engine only (its per-source fetchers); GitHub for the managed engine refresh |
122| `LOCAL_FS` | `~/.cache/oma-market/last30days/<tag>/` (engine), `~/.config/last30days/` (engine config, keys), `.agents/results/market/` (brief + raw) |
123| `PROCESS` | `oma market` subcommands → `python3 scripts/last30days.py` |
124
125### Preconditions
126- Topic passes detect-trap.
127- `oma market resolve` is ok (engine present; Python ≥ 3.12 found on PATH, via `uv`, or pinned with `market.python` / `LAST30DAYS_PYTHON`).
128
129### Effects and side effects
130- Writes the brief to `.agents/results/market/{topic-slug}-{YYYYMMDD}.md` and raw engine files to `market.save_dir`.
131- First run: the upstream setup wizard may write `~/.config/last30days/.env` (with user consent) and, when Python 3.12 is absent but `uv` exists, may install a managed CPython 3.12 (~28 MB) after telling the user.