1---
2name: oma-market
3description: Market research skill for pain-point extraction, trend detection,
4 competitor positioning, and discovery across community sources (Reddit, X,
5 YouTube, TikTok, HN, Polymarket, GitHub, arXiv, Techmeme, Bluesky, web and
6 more). Delegates research to the always-latest mvanhorn/last30days engine via
7 `oma market run`, adds oma's detect-trap preflight, intent-auto SWOT /
8 Porter's 5F / PESTEL framing, and a single LAW-compliant brief. Use for market
9 research, pain point analysis, trend detection, competitor research, user
10 complaints, voice-of-customer, 시장조사, 사용자 페인, 트렌드, 경쟁구도.
11---
12
13# Market Research Agent - Community Signal Intelligence
14
15## Scheduling
16
17### Goal
18Run 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/`.
19
20### Intent signature
21- User asks about pain points, user complaints, or voice-of-customer signals for a product or category.
22- User asks what is trending, growing, or declining in a space this week or month.
23- User asks how one product compares to another in community sentiment or positioning.
24- User asks for discovery or exploratory market research on a topic, a person, a company, or a ticker.
25
26### When to use
27- Extracting real user pain points from community posts (Reddit with real upvotes and top comments, HN, X, Bluesky, GitHub Issues)
28- Detecting trends in a category over a window (`--days 7|30|90|180`)
29- Competitor sentiment analysis and SWOT / Porter's 5F positioning
30- Open-ended discovery research (`--discover`), person mode, hiring signals (`--hiring-signals`), follow-up drills (`--drill`)
31
32### When NOT to use
33- General web research without market framing -> use oma-search directly
34- Academic literature -> use oma-scholar
35- Live dashboards or scheduled monitoring -> `oma schedule <action>` wrapping this skill
36
37### Expected inputs
38- Topic string; optional `--intent pain|trend|competitor|discovery` (else classified per `resources/intent-rules.md`)
39- Optional window (`--days`), `--vs <entity>` (competitor), `--frameworks auto|none|swot,5f,pestel`
40- Any native last30days flag (see `oma market run --help`) — passed through verbatim
41
42### Expected outputs
43- Single markdown brief at `.agents/results/market/{topic-slug}-{YYYYMMDD}.md`
44- 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
45- Raw engine artifacts under `market.save_dir` (default `.agents/results/market/raw/`)
46
47```yaml
48outputs:
49 - name: market-brief
50 description: Single LAW-compliant markdown brief with framework sections
51 artifact: ".agents/results/market/*.md"
52 required: true
53```
54
55### Dependencies
56- `oma market resolve` / `oma market run` — engine location, Python 3.12+ resolution, `--save-dir` default
57- The upstream `SKILL.md` at the resolved engine root (`skillMd` in `oma market resolve --json`) — the authoritative research contract
58- `resources/intent-rules.md`, `resources/frameworks/`, `resources/output-laws.md`, `resources/execution-protocol.md`
59
60### Control-flow features
61- `oma market detect-trap` gate before anything else (exit 2 = REFUSE, exit 4 = invalid)
62- 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
63- Sources needing keys/cookies auto-skip inside the engine; keyless sources (Reddit, HN, GitHub, Polymarket, arXiv, Techmeme, Digg, web) always run
64- Framework auto-toggle by intent (pain/trend → SWOT; competitor → SWOT + Porter's 5F; discovery → SWOT + PESTEL)
65
66## Structural Flow
67
68### Entry
691. Run `oma market detect-trap "<topic>"`. Exit 2 → surface the REFUSE reason and reframe suggestion, stop.
702. 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.
713. 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`.
724. Classify intent per `resources/intent-rules.md`; map to engine flags and framework set.
73
74### Scenes
751. **PREPARE**: detect-trap, resolve, read upstream SKILL.md, classify intent.
762. **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.
773. **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.
784. **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/`).
795. **FINALIZE**: run the self-check in `resources/output-laws.md`, write `.agents/results/market/{topic-slug}-{YYYYMMDD}.md`, preview the first 50 lines.
80
81### Transitions
82- `--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.
83- Person / company / ticker topics → upstream person / hiring-signals / StockTwits handling applies unchanged.
84- `engine.status: stale` → include the `note` in the report (research ran on the cached engine version).
85
86### Failure and recovery
87- detect-trap exit 2 → REFUSE; do not run the engine; `--force` only on explicit user reconfirmation.
88- `oma market resolve` not ok → stop with the reason; no engine run.
89- 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.
90- Upstream Python-version gate / setup wizard messages → relay to the user exactly as the upstream contract instructs.
91
92### Exit
93- Success: brief written with badge, clusters, frameworks, and engine footer; path reported.
94- Partial: engine ran with skipped sources (footer lists them) — say so; never pad with invented evidence.
95
96## Logical Operations
97
98### Actions
99| Action | SSL primitive | Evidence |
100|--------|---------------|----------|
101| detect-trap preflight | `VALIDATE` | Topic arg, trap pattern rules |
102| Resolve engine + Python | `CALL_TOOL` | `oma market resolve --json` |
103| Read upstream contract | `READ` | `engine.skillMd` |
104| Classify intent | `SELECT` | `resources/intent-rules.md` |
105| Upstream pre-research steps | `INFER` | Upstream SKILL.md Steps 0–0.75 |
106| Run engine | `CALL_TOOL` | `oma market run <args>` |
107| Synthesize + frameworks | `WRITE` | Upstream OUTPUT CONTRACT, `resources/frameworks/` |
108| Self-check + write brief | `WRITE` | `resources/output-laws.md`, `.agents/results/market/` |
109
110### Tools and instruments
111- `oma market detect-trap <topic>` (preflight gate)
112- `oma market resolve [--refresh|--offline] [--json]` (engine + Python resolution; managed latest)
113- `oma market update` (force-refresh the managed engine)
114- `oma market run <engine args…>` (passthrough to `scripts/last30days.py`)
115
116### Canonical command path
117```bash
118TOPIC="VS Code pain points"
119oma market detect-trap "$TOPIC"
120oma market resolve --json # read .engine.skillMd, then follow it
121# … upstream Steps 0 / 0.45 / 0.5 / 0.55 / 0.75 …
122oma market run "$TOPIC" --plan "$QUERY_PLAN_FILE" --subreddits=vscode --emit=compact --save-suffix=v3
123```
124
125### Resource scope
126| Scope | Resource target |
127|-------|-----------------|
128| `NETWORK` | Inside the engine only (its per-source fetchers); GitHub for the managed engine refresh |
129| `LOCAL_FS` | `~/.cache/oma-market/last30days/<tag>/` (engine), `~/.config/last30days/` (engine config, keys), `.agents/results/market/` (brief + raw) |
130| `PROCESS` | `oma market` subcommands → `python3 scripts/last30days.py` |
131
132### Preconditions
133- Topic passes detect-trap.
134- `oma market resolve` is ok (engine present; Python ≥ 3.12 found on PATH, via `uv`, or pinned with `market.python` / `LAST30DAYS_PYTHON`).
135
136### Effects and side effects
137- Writes the brief to `.agents/results/market/{topic-slug}-{YYYYMMDD}.md` and raw engine files to `market.save_dir`.
138- 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.