Skip to content

Deep Think Pipeline ​

Deep Think takes a raw thought and runs it through three LLM stages -- Expand, Counterpoint, Synthesize -- to produce a structured research brief. The output is a JSON document with a concrete thesis, supporting arguments, risks, prior art, open questions, next steps, and readiness gates.

Deep Think turns a one-line idea into an actionable brief in under a minute.

When to Use It ​

Deep Think is most valuable for:

  • Ideas that need vetting before you commit time to them
  • Architecture decisions where you want structured pros/cons
  • Patterns you want to stress-test before adopting
  • Any thought where you want your vault's existing knowledge to challenge the new idea

You can trigger Deep Think from any capture path:

  • App popup -- toggle the "Deep think" pill before saving
  • Slash template -- the default /idea template enables Deep Think automatically
  • MCP -- cortexa_think({ item_id: "..." }) on any existing thought
  • CLI -- cortexa-cli think <item-id>
  • Per-source defaults -- configure in Settings > Notifications so certain sources always run Deep Think

The Three Stages ​

Stage 1: Expand ​

The Expand stage decomposes your raw thought into a structured analysis through four thinking lenses.

System prompt behavior:

  1. THESIS -- restates the idea as a single concrete, falsifiable claim. Strips vague words ("scalable", "innovative", "better") and replaces each with a measurable or demonstrable claim.

  2. SUB-QUESTIONS -- generates 3-7 questions that must be answered for the idea to be actionable. Framed as "What would have to be true for...?" and "What's the smallest testable version?"

  3. EXPANSION -- explores implications, applications, and adjacent concepts. Names specific technologies, competitors, or prior art.

  4. THINKING LENSES -- applies four analytical frames:

    • Pre-mortem -- assume the idea failed. Why?
    • First principles -- what are the base assumptions? Which could be wrong?
    • Inversion -- what would make this maximally fail? Avoid that.
    • Steelman -- what is the strongest version of the opposing view?

The output is 4-8 paragraphs covering all four sections. It is stored as the thought's expansion and the pipeline advances to Counterpoint.

Stage 2: Counterpoint ​

The Counterpoint stage is a rigorous critic and contradiction detector. It receives the original thought, the expansion from Stage 1, and related prior thoughts from your vault.

Vault-aware contradiction detection: Cortexa pulls the 8 nearest neighbors from the HNSW index (above 0.4 similarity) and passes them to the LLM alongside the expansion. This means the critique is grounded in your actual prior decisions and knowledge, not just the LLM's training data.

The LLM produces four sections:

  1. CRITIQUE -- the 3-5 strongest weaknesses, false assumptions, or failure modes. For each, it explains why it is a problem and what evidence would change its mind.

  2. CONTRADICTIONS -- compares the idea against your prior thoughts. Flags direct contradictions: "You previously argued X, but this idea assumes not-X." Quotes the prior thought when relevant.

  3. PRIOR ART -- names similar ideas, implementations, or research concretely. What did they learn? How is this idea different (or not)?

  4. DEVIL'S ADVOCATE -- the strongest 2-paragraph argument against pursuing the idea, assuming limited time.

The output is stored as the thought's counterpoints and the pipeline advances to Synthesize.

Stage 3: Synthesize ​

The Synthesize stage takes all prior output -- the original thought, the expansion, and the counterpoints -- and produces a single structured JSON brief. The LLM outputs raw JSON (no markdown fences, no prose) matching the ThesisOutput schema exactly.

The ThesisOutput Schema ​

json
{
  "core": "One-sentence thesis -- concrete, falsifiable",
  "problem_statement": "What specific problem this solves, for whom",
  "sub_questions": [
    "Questions that need answers before this is buildable"
  ],
  "supporting_arguments": [
    "Evidence or reasoning that supports the idea"
  ],
  "risks": [
    "Specific risks with concrete failure scenarios"
  ],
  "prior_art": [
    "Known implementations, competitors, or research -- be specific"
  ],
  "open_questions": [
    "Unresolved questions the user needs to decide"
  ],
  "next_steps": [
    "Concrete, ordered actions -- the first should be the smallest testable thing"
  ],
  "confidence": "speculation | partially-vetted | well-researched",
  "contradictions": [
    "Conflicts with prior thoughts, if any were flagged"
  ],
  "lenses": [
    { "lens": "pre-mortem", "output": "One-paragraph summary" },
    { "lens": "first-principles", "output": "One-paragraph summary" },
    { "lens": "steelman-against", "output": "One-paragraph summary" }
  ],
  "gates": [
    { "name": "problem-stated", "status": "closed", "detail": "..." },
    { "name": "success-criterion", "status": "open", "detail": "..." },
    { "name": "scope-bounded", "status": "closed", "detail": null },
    { "name": "approach-selected", "status": "open", "detail": null },
    { "name": "open-questions-resolved", "status": "deferred", "detail": null },
    { "name": "prior-art-reviewed", "status": "closed", "detail": null },
    { "name": "risks-acknowledged", "status": "closed", "detail": null },
    { "name": "first-milestone-identified", "status": "open", "detail": "..." }
  ]
}

Every field is required. For arrays, the LLM includes at least one item (using "none identified" if truly empty). The gates array always has all 8 entries.

Field reference ​

FieldTypeDescription
corestringOne-sentence thesis. Concrete and falsifiable -- no vague claims.
problem_statementstringWhat specific problem this solves and for whom.
sub_questionsstring[]Questions that must be answered before the idea is actionable.
supporting_argumentsstring[]Evidence or reasoning supporting the idea.
risksstring[]Specific risks with concrete failure scenarios.
prior_artstring[]Known implementations, competitors, or research.
open_questionsstring[]Unresolved questions the user needs to decide.
next_stepsstring[]Concrete, ordered actions. The first should be the smallest testable thing.
confidenceenumspeculation, partially-vetted, or well-researched.
contradictionsstring[]Conflicts with prior thoughts from your vault.
lensesobject[]Thinking lens summaries (pre-mortem, first-principles, steelman-against).
gatesobject[]Readiness gates (see below).

Readiness Gates ​

The 8 readiness gates act as a checklist for idea maturity. Each gate is closed (resolved), open (not yet resolved), or deferred (acknowledged but intentionally postponed).

GateWhat it checks
problem-statedIs the problem clearly defined?
success-criterionIs there a measurable definition of success?
scope-boundedAre boundaries set on what this idea does and does not include?
approach-selectedIs there a chosen technical or strategic approach?
open-questions-resolvedAre the critical unknowns answered?
prior-art-reviewedHas existing work in this space been examined?
risks-acknowledgedAre the key risks identified and accepted?
first-milestone-identifiedIs there a concrete first step to validate the idea?

Gates give you a quick read on whether an idea is ready to act on. An idea with 7/8 gates closed and one deferred is in good shape. An idea with 3/8 gates open needs more work before committing resources.

In the Cortexa UI, the brief view renders gates as a visual checklist. Agents retrieving the brief via cortexa_brief can programmatically inspect gate status:

json
// Agent checks if an idea is ready to implement
const brief = cortexa_brief({ item_id: "abc123" });
const openGates = brief.gates.filter(g => g.status === "open");
if (openGates.length > 0) {
  // "These gates are still open: success-criterion, approach-selected"
}

Pipeline Flow ​

Capture thought
     │
     ▼
┌─────────┐   expansion    ┌──────────────┐  counterpoints  ┌────────────┐
│  Expand  │ ────────────▶  │ Counterpoint │ ─────────────▶  │ Synthesize │
│          │                │              │                  │            │
│ 4 lenses │                │ vault-aware  │                  │ JSON brief │
│ sub-Qs   │                │ critique     │                  │ 8 gates    │
└─────────┘                └──────────────┘                  └────────────┘
                                   │
                          ┌────────┴────────┐
                          │ HNSW neighbors  │
                          │ (your archive)  │
                          └─────────────────┘

Each stage is a separate background job. Progress events (thesis-progress) are emitted after each stage so the UI updates in real time. The thesis status transitions through: Expanding -> Critiquing -> Synthesizing -> Done.

Triggering and Retrieving ​

Trigger Deep Think ​

bash
# CLI
cortexa-cli think <item-id>

# MCP
cortexa_think({ item_id: "<item-id>" })

Retrieve the brief ​

Deep Think is asynchronous. Poll cortexa_brief until the result is ready:

bash
# CLI (polls automatically until done)
cortexa-cli brief <item-id>

# CLI with raw JSON output
cortexa-cli brief <item-id> --json

# MCP
cortexa_brief({ item_id: "<item-id>" })

In the app UI, expand any thought and click the thesis section to see the brief rendered with all fields and gates.

JSON Parsing Robustness ​

LLMs sometimes wrap JSON in markdown fences, add a prose preamble, or produce slightly malformed output. Cortexa's parser handles all of these:

  • Clean JSON -- parsed directly
  • Fenced JSON -- ````json ... ``` `` wrappers are stripped
  • Chat preamble -- "Sure! Here is the JSON:" prefix is stripped; the first { to last } is extracted
  • Partial output -- if the JSON is truncated or malformed, the pipeline records the error and the thought's thesis status reflects the failure

The parser is covered by 4 unit tests (parses_clean_json, parses_fenced_json, parses_json_with_chat_preamble, rejects_non_json).

Tips ​

  • Use /idea: for new ideas. The default template enables Deep Think automatically, so you get a brief without any extra clicks.
  • Review the contradictions field. This is where Deep Think is most valuable -- it surfaces conflicts between your new idea and things you have already committed to.
  • Check gates before committing. If problem-stated or success-criterion are open, the idea needs more definition before implementation.
  • Re-run Deep Think after changes. If you refine a thought significantly, trigger Deep Think again. The new brief replaces the old one.

Orchestrator Mode ​

When Use Orchestrator is enabled in Settings, Deep Think replaces the fixed three-stage pipeline with the intelligent orchestration layer. The orchestrator LLM reads your thought and dynamically picks from the agent tool registry (Analyst, Critic, Writer, Researcher, Connector, Librarian, Janitor, Custodian, Synthesist, Visualizer, Scheduler, Historian), building a custom execution plan with parallel scheduling.

Use the Preview Plan button to see what the orchestrator will run before executing.

See Orchestration Agents for full details.

What's Next ​

Built with Rust, Tauri, and a lot of captured thoughts.