T4 epic · research / consulting / VC: plan-then-execute. A planning pass turns the topic into four queries, an agent works the web under explicit budgets, and a synthesis pass writes the brief. Three stages, each with its own ceiling, and the brief lands on disk with its sources.
The job
« Get me up to speed on X by Thursday » is two days of tabs, or it’s this pipeline: four sharp queries planned, researched with verbatim quotes and source tracking, synthesized into an executive brief that separates what’s true from what’s contested.The shape
The file
deep-research-brief.nika
How it works
1
Each stage has its own ceiling
plan is a schema-typed call capped at 400 tokens, the agent is
bounded by turns and tokens, and brief is capped at 2,000 tokens. One
envelope model serves the three stages; a task can pin its own
model: when one stage deserves a different model.2
The agent has a leash
max_turns: 25 + max_tokens_total: 120000 bound the loop;
nika:done lets it exit cleanly when the plan is exhausted. The
final message must match the schema: findings AND sources.3
Callable by other workflows
The typed
outputs: (brief, sources) make this a building
block: a parent workflow can consume the contract without parsing
prose.Constructs you just used
Run it
What it needs: Nothing to rehearse: under
--model mock/echo the whole file, agent loop included, runs on the mock model with zero keys and no model call. The mock replaces the model, not the network: the agent’s nika:fetch stays granted for the hosts in permits.net.http. Real research needs a model that calls tools and network access to the hosts in permits.net.http.1
Rehearse it
nika try names the hosts a step may reach: may reach: arxiv.org · export.arxiv.org · en.wikipedia.org · hn.algolia.com — the mock replaces the model, not the network.2
Get your own copy
Save the file above as
deep-research-brief.nika in a new folder. It reads no sample file.3
Check it, then run it
research/<slug>.md.Any other model works: pass --model <provider>/<name> with its key, and cap a cloud model with --max-cost-usd.--var topic="…" picks the subject; the file derives a safe slug from it for the filename.Make it yours
- Force source-grounding harder: have
briefcite${{ tasks.investigate.output.sources }}inline per claim. - Competitive variant: seed
planwith Competitor radar’s digest instead of a bare topic. - Weekly cadence: pair with your scheduler and diff this week’s brief against last week’s with
nika:json_diff.
Next · Incident war room
Parallel evidence gathering, a settle-and-recheck loop, and a
postmortem that refuses to claim recovery it can’t prove.