Time to open the black box. You’ll understand the 3 phases behind the scenes, the two files that make everything resumable and cost-efficient (state.json e research_cache.json), how to recover from failures, and the exact folder structure output/.
Illustrative diagram — the 3 phases in sequence, with the research cache and the state checkpoint.
Everything starts with intelligence gathering. In the first phase, the Perplexity runs 9 to 18 searches (depending on the mode) about the company and its industry. This is the raw material for all the documents that come next.
The quality of the research sets the quality ceiling for the documents. That’s why the --context and choosing the mode (2.1 and 2.2) matter just as much: they improve this phase.
With the research in hand, the Gemini writes the 15 documents. The important detail: they are generated in dependency order — some are created only after others are ready because they use the earlier ones as input.
# Exemplo simplificado da cadeia de dependência:
inventário técnico ─┐
dores ───┼─→ avaliação de maturidade ─→ roadmap ─→ quick wins
│
└─→ diagramas, ROI, governança, ...
# Um documento "downstream" lê os documentos "upstream"
# já prontos. Por isso não dá para gerar tudo em paralelo.
Between one Gemini call and the next, there’s a pause of about 5 seconds. It’s not slowness—it’s protection: it respects the API request limits and prevents the 429 error.
If the synthesis seems "stuck," it’s probably pausing to respect the limit. Let it finish — interrupting here only means you’ll have to use the resume later.
The final phase runs entirely on your computer, at no cost. It turns the text into Office files and renders the diagrams as images.
Builds the 2 PowerPoint files with the library python-pptx.
Generates the 2 Word reports from the documents.
Renders Mermaid diagrams using Chrome/Puppeteer.
If the PNGs aren’t generated, Chrome/Puppeteer is usually unavailable. The text documents are still created — only image rendering depends on it.
Inside each company's folder, there's a checkpoint: o state.json. It’s the brain behind resuming — it stores everything the tool needs to know to pick up where it left off.
{
"company": "Stripe",
"current_phase": "synthesis",
"deliverables_done": ["01_tech_inventory", "02_pain_points"],
"cost_spent_usd": 0.31,
"errors": []
}
Illustrative structure—the actual fields may vary, but the idea is the same: phase, ready, cost, and errors.
If the state.json is the brain, the research_cache.json is the vault: it stores the Perplexity raw research. Since research is the part that costs money, this cache is your biggest ally in saving money.
# A primeira execução paga a pesquisa e a grava no cache
python -m strategy_factory.main run "Stripe"
# Mexeu num prompt e quer só regerar os documentos?
# Reusa o cache — não paga a pesquisa de novo:
python -m strategy_factory.main run "Stripe" --skip-research
Remember Phase 3: generation is already free. The biggest expense is research (Phase 1). Reuse it with --skip-research is what makes your experiments cost almost nothing.
Failures happen: you press Ctrl+C, the internet goes down, or you hit the API limit. The good news is that, thanks to the state.json, you never lose the work (or money) already spent.
# Caiu no meio? Apenas retome:
python -m strategy_factory.main resume "Stripe"
# Em erro 429 (limite atingido):
# 1. Espere alguns minutos
# 2. Rode o resume novamente
O state.json saved your progress. Run resume and continue.
Reconnect and run resume. The research already done comes from the cache.
You hit the API limit. Wait a few minutes for the limit to reset, then run resume.
It's fine to run resume several times: it always looks at the state.json and only does what’s still missing. It never redoes (or charges for) what’s already done.
Everything the tool produces goes to a predictable place: the folder output/{slug}/, one per company. Knowing this structure lets you find any file in an instant.
output/stripe/
├── markdown/ # 15 documentos .md
├── presentations/ # 2 apresentações .pptx
├── documents/ # 2 relatórios .docx
├── mermaid_images/ # 5 diagramas .png
├── state.json # checkpoint (fase, custo, erros)
└── research_cache.json # pesquisa bruta da Perplexity
All text documents: from the technical inventory to the change management plan. Track 3 opens each one.
An executive summary and a complete presentation of findings.
The final strategy report and the statement of work.
Current state, future state, data flow, roadmap, and integration.
Each company = a self-contained folder. Deliverables are separated by type, and the two JSON files store the state and cache. That's everything you need to understand, resume, and reuse an analysis.
Track 3 — Deliverables — now that you know how the tool works inside and out, open each of the 15 documents and learn how to use them in practice.