Competitive Intelligence Agent
Use this skill to operate a competitive-intelligence repo as an agent tool system, not just a report script. Prefer a reliable sample-first path, then opt into live CocoIndex only when credentials and Postgres are ready.
Workflow
- Find the repo root. Look for
mcp_server.py,local_intel.py,watchlist.json, and optionaldocker-compose.yml. - Inspect current state before editing:
git status --short,rg -n "run_cocoindex_update|FastMCP|CocoIndex|COMPETITORS" .. - Use sample mode first unless the user explicitly asks for live ingestion.
- For live mode, verify
.envhasCOCOINDEX_DATABASE_URL,TAVILY_API_KEY, andOPENAI_API_KEY; never print secret values. - Keep generated briefs, dashboards, and JSON/CSV report artifacts out of commits unless the repo explicitly tracks samples.
- Run focused tests before committing.
Sample Demo
Use this path for a reliable demo without API keys:
python3 local_intel.py --dashboard --slug demo
python3 agent_demo.py --slug demo-agent
python3 -m unittest test_local_intel.py
Expected outputs usually land in reports/:
- Markdown brief
- JSON/CSV event export
- static HTML dashboard
- deterministic agent transcript, if
agent_demo.pyexists
MCP Tool Demo
Start the MCP server from the repo environment:
python3 mcp_server.py
For client setup, prefer a repo-provided mcp-config.example.json. Use an absolute Python path and an absolute mcp_server.py path. If the repo is also packaged as a Codex plugin, keep plugin-specific local paths out of public docs.
Useful agent calls:
get_trending_competitors(limit=5)
search_events(query="enterprise customers", limit=5)
create_brief(slug="board-brief")
create_dashboard(slug="demo-dashboard")
Live CocoIndex
Use live ingestion only when explicitly requested. Start Postgres if the repo provides Docker support:
docker compose up -d postgres
Run with explicit per-call competitors instead of editing .env for every scenario:
run_cocoindex_update(
live=true,
competitors="Apple,Microsoft",
max_results=2,
event_query="(product launch OR partnership)",
search_days_back=14
)
Then query the indexed data:
search_events(mode="cocoindex", competitor="Apple", limit=5)
get_trending_competitors(mode="cocoindex", days=7)
create_brief(mode="cocoindex", slug="apple-microsoft-live")
create_dashboard(mode="cocoindex", slug="apple-microsoft-live")
competitors may be a comma-separated string or a JSON array. Treat .env values as defaults, not fixed behavior.
Validation
For code changes, run:
python3 -m py_compile main.py mcp_server.py providers.py local_intel.py
python3 -m unittest test_local_intel.py
For live changes, add one small credential-gated smoke:
python3 live_demo_check.py \
--slug live-smoke \
--competitors "Apple" \
--max-results 1 \
--event-query "(product launch)"
Report whether live mode used sample data, local Postgres, or a remote database. Be explicit when live checks were skipped because credentials, Docker, network, or API quota were unavailable.
References
Read references/cocoindex-agent-demo.md when adding docs, README sections, plugin instructions, or MCP client examples for this workflow.