Trilogy Ecosystem
DocMind Deep Flux | SDK Framework Forge Cube | ◊ Mesh
THE AI PIPELINE FRAMEWORK

Input Intelligence Output

Three APIs. One declarative flow. Parse documents, run deep research, generate content — as a single pipeline.

DocMind
Deep
Flux
$ npm install trilogy-framework
Pipeline
Preset
Parallel
Conditional
Events
const { Trilogy } = require('trilogy-framework');

const t = new Trilogy({
  docmind: 'dm_p_...',
  deep:    'deep_p_...',
  flux:    'flux_p_...',
});

// Receipt → research the merchant → write a blog about it
const result = await t.pipeline()
  .name('receipt-to-blog')
  .parseReceipt('./receipt.jpg')
  .research(ctx => `Tell me about ${ctx.document.merchant}`)
  .blog(ctx => `Expense spotlight: ${ctx.document.merchant}`)
  .run();

console.log(result.content);   // blog post
console.log(result.document);  // parsed receipt data
console.log(result.research);  // merchant research
console.log(result._pipeline); // { total_ms, steps: [...] }
// One-liners — 15 pre-built pipelines

// Research → Twitter thread
const thread = await t.researchToThread('Why AI agents are replacing SaaS').run();

// Compare → blog post
const blog = await t.compareToBlog(
  ['React', 'Vue', 'Svelte'],
  ['performance', 'ecosystem', 'DX']
).run();

// Raw draft → SEO + improve + repurpose into 5 formats
const blitz = await t.contentBlitz(myDraft).run();

// Contract → research terms → summary email
const email = await t.contractToEmail('./contract.pdf').run();

// Fact-check → debunking thread
const facts = await t.factCheckToThread([
  'The Great Wall is visible from space',
  'Humans use 10% of their brain',
]).run();
// Research once → generate blog + thread + social in parallel
const result = await t.pipeline()
  .research('MCP protocol — what developers need to know')
  .parallel(
    p => p.blog(ctx => ({ topic: 'MCP Deep Dive', context: ctx.research })),
    p => p.thread(ctx => ({ topic: 'MCP Explained', context: ctx.research })),
    p => p.social(ctx => ({ topic: 'MCP is here', context: ctx.research })),
  )
  .run();

// All three generated simultaneously from the same research
// Only research if receipt total > $100
const result = await t.pipeline()
  .parseReceipt('./receipt.jpg')
  .when(
    ctx => ctx.document.total > 100,
    p => p.research(ctx => `Is ${ctx.document.merchant} overcharging?`)
  )
  .blog(ctx => `Expense report: ${ctx.document.merchant}`)
  .run();

// Loop over URLs
await t.pipeline()
  .context({ urls: ['https://a.com', 'https://b.com'] })
  .each('urls', p => {
    p.extract(ctx => ctx.item)
     .blog(ctx => ({ topic: ctx.item, context: ctx.extracted }));
  })
  .run();
const result = await t.pipeline()
  .name('tracked-pipeline')
  .onStep(event => {
    console.log(`[${event.phase}] ${event.step}${event.index + 1}/${event.total}`);
    // [input] parse.receipt — 1/3
    // [intelligence] research — 2/3
    // [output] generate.blog — 3/3
  })
  .onError((err, step) => {
    console.error(`Step "${step.name}" failed: ${err.message}`);
    // Pipeline continues — non-fatal
  })
  .parseReceipt('./receipt.jpg')
  .research(ctx => ctx.document.merchant)
  .blog(ctx => ctx.document.merchant)
  .run();

console.log(result._pipeline.total_ms);  // 8432
console.log(result._pipeline.steps);     // full timeline

Why Trilogy

Three APIs unified into one declarative framework

Declarative Pipelines

Chain input, intelligence, and output steps into one readable flow. No callbacks. No glue code. Just .parseReceipt().research().blog().run()

Context Flows Automatically

Each step's output merges into shared context. Later steps access earlier results via ctx => functions. Zero boilerplate.

15 Ready-Made Presets

One-liner pipelines for common flows. researchToThread(), contentBlitz(), contractToEmail() — just call and .run().

Parallel Execution

Generate blog + thread + social simultaneously from the same research. .parallel() runs branches concurrently and merges results.

Control Flow

Conditionals with .when(), loops with .each(), transforms with .transform(), side effects with .tap().

Full Observability

Step events, error handlers, execution timelines. Every pipeline returns _pipeline metadata with per-step timing and status.

Three Engines. One Pipeline.

Each phase maps to a dedicated API

Input

DocMind API
  • .parseReceipt()
  • .parseInvoice()
  • .parseBankStatement()
  • .parseContract()
  • .chat()

Intelligence

Deep API
  • .research()
  • .researchDeep()
  • .factCheck()
  • .compare()
  • .extract()
  • .seo()

Output

Flux API
  • .blog()
  • .thread()
  • .social()
  • .email()
  • .ads()
  • .product()
  • .landing()
  • .repurpose()
  • .improve()

15 Pre-Built Pipelines

Common flows as one-liners

receiptToBlog
InputIntelOutput
Parse receipt, research merchant, generate blog post
researchToThread
IntelOutput
Deep research any topic, generate Twitter thread
researchToAll
IntelOutput ×3
Research → blog + thread + social in parallel
compareToBlog
IntelOutput
Compare entities across aspects, generate analysis blog
factCheckToThread
IntelOutput
Verify claims with evidence, generate debunking thread
contentBlitz
SEOImproveRepurpose
SEO optimize, improve quality, repurpose into 5 formats
invoiceToReport
InputIntelOutput
Parse invoice, research vendor credibility, generate report
contractToEmail
InputIntelOutput
Parse contract, research key terms, generate summary email
extractToBlog
IntelOutput
Extract data from URL, generate analysis blog post
researchToBlog
IntelOutput
Deep research with streaming, generate long-form blog
researchToEmail
IntelOutput
Research topic, generate email newsletter
statementToReport
InputOutput
Parse bank statement, generate financial summary