@polyweave/triz (1.0.1)
Installation
@polyweave:registry=https://hub.kl1.tenere.ai/api/packages/Polyweave/npm/npm install @polyweave/triz@1.0.1"@polyweave/triz": "1.0.1"About this package
triz
LLM-driven TRIZ and DIKWP-TRIZ methodology engine: contradiction detection, inventive-principle selection, 3-No classification, DIKWP transformations with semantic axioms, and technical spec writing. Multi-state evidence grounding and bt-harness orchestration.
Published as @polyweave/triz.
Synopsis
import {
createTrizTool,
createTrizHarness,
detectTrizContradictions,
proposeInventivePrinciples,
scoreTrizIdea,
TRIZ_SPEC
} from '@polyweave/triz';
const tool = createTrizTool({
apiKey: process.env.API_KEY,
model: 'deepseek-v4-flash',
state: myMultiStateStore
});
tool.sink.write({
type: 'TOOL_CALL',
content: { problem: 'Battery weight vs. capacity trade-off in electric vehicles' }
});
tool.source.pipe(mySink);
Install
npm install @polyweave/triz
Description
The triz package implements a full LLM-driven TRIZ (Theory of Inventive Problem Solving) methodology engine, extended with DIKWP (Data-Information-Knowledge-Wisdom-Purpose) transformations and semantic axioms for creative problem-solving. It detects engineering contradictions in problem statements, selects appropriate inventive principles from the TRIZ matrix, applies 3-No classification (No Compromise, No Delay, No Waste), performs DIKWP layer transformations, and scores creative ideas against a multi-dimensional rubric.
The package includes:
- TRIZ Tool — A bt-harness duplex tool that orchestrates the full TRIZ pipeline: contradiction detection → inventive principle selection → DIKWP transformation → semantic axiom verification → idea scoring.
- TRIZ Harness — Standalone bt-harness wrapper with the TRIZ behavior tree spec (
TRIZ_SPEC). - Pure Functions — All core TRIZ logic exposed as standalone functions for programmatic use.
- Data Tables — Full TRIZ engineering parameters (39 parameters), inventive principles (40 principles), and DIKWP-TRIZ contradiction matrix.
- Protocol Growing —
growTrizProtocolanddefaultTrizProtocolSeedsfor nursery-based TRIZ protocol optimization.
API
createTrizTool(options)
Creates a bt-harness duplex tool implementing the full TRIZ pipeline.
Parameters:
options.apiKey— API key for LLM calls.options.model— Model name (default'deepseek-v4-flash').options.state— Multi-state store for evidence grounding (optional).options.createAdapter— Custom adapter factory.options.adapterConfig— Adapter factory configuration.options.debug— Enable debug output.
TOOL_CALL args: { problem, context, domain, constraints }
Returns: { source, sink, _toolName: 'triz', close }
Events on source:
TOOL_RESULT— Final result with{ contradictions, principles, dikwpTransformations, axiomsChecked, scoredIdeas }.PROGRESS— Pipeline stage updates:contradiction_detection,principle_selection,dikwp_transformation,axiom_check,idea_scoring.
createTrizHarness(options)
Creates a standalone bt-harness for TRIZ execution.
Parameters: Same as createTrizTool.
Returns: bt-harness-compatible tool with { source, sink, cancel, abort }.
createTrizTools(options)
Creates an array of individual TRIZ tool adapters (one per pipeline stage).
Returns: Array of [{ source, sink }, ...] for detectContradictions, selectPrinciples, dikwpTransform, checkAxioms, scoreIdeas.
Pure Functions
detectTrizContradictions(problem, context, callback)
Detects engineering contradictions in a problem statement, mapping to TRIZ parameters.
Parameters: problem — Problem description string, context — Optional domain context.
Returns via callback: { contradictions: [{ improving: paramId, worsening: paramId, description }] }
classifyThreeNo(problem, callback)
Classifies a problem across three TRIZ dimensions.
Returns: { noCompromise: number, noDelay: number, noWaste: number } (0–1 scores).
chooseTrizBranch(contradictions, callback)
Selects the most promising TRIZ solution path.
Returns: { branch: string, confidence: number }
proposeInventivePrinciples(contradictions, callback)
Selects applicable inventive principles from the TRIZ contradiction matrix.
Returns: { principles: [{ id, name, description, applicability }] }
proposeDikwpTransformations(problem, contradictions, principles, callback)
Proposes DIKWP layer transformations for the problem.
Returns: { transformations: [{ fromLayer, toLayer, transformation, rationale }] }
checkSemanticAxioms(transformations, callback)
Validates transformations against DIKWP semantic axioms.
Returns: { axiomChecks: [{ axiom, satisfied, explanation }] }
scoreTrizIdea(idea, contradictions, principles, callback)
Scores a TRIZ-generated idea against a multi-dimensional rubric.
Returns: { score: number, dimensions: { novelty, feasibility, elegance, impact, specificity } }
growTrizProtocol(options)
Nursery-based protocol growing for TRIZ applications.
defaultTrizProtocolSeeds
Array of default BT spec seeds for TRIZ protocol generation.
Constants
TRIZ_SPEC— Behavior tree specification for the TRIZ pipeline.TRIZ_PROJECTIONS— Projection definitions for multi-state entity storage.TRIZ_ENGINEERING_PARAMETERS— Array of 39 TRIZ engineering parameters with IDs and descriptions.TRIZ_INVENTIVE_PRINCIPLES— Array of 40 inventive principles with IDs and descriptions.DIKWP_DIMENSIONS— D-I-K-W-P dimension definitions.DIKWP_TRIZ_MATRIX— Cross-reference matrix mapping contradictions to applicable principles.
Examples
// Pure function usage without bt-harness
import { detectTrizContradictions, proposeInventivePrinciples, scoreTrizIdea } from '@polyweave/triz';
detectTrizContradictions(
'We need a smartphone battery with longer life but it must stay thin and lightweight',
'consumer electronics',
(err, contradictions) => {
proposeInventivePrinciples(contradictions.detected, (err, principles) => {
console.log('Recommended principles:', principles.map(p => p.name));
// e.g., ["Segmentation", "Parameter Change", "Composite Materials"]
});
}
);
// Full pipeline via tool
const tool = createTrizTool({ apiKey: process.env.API_KEY, state: myState });
tool.sink.write({
type: 'TOOL_CALL',
content: {
problem: 'Data center cooling uses too much water but reducing water impacts efficiency',
domain: 'infrastructure',
constraints: ['Cost < $1M', 'ROI < 3 years']
}
});
tool.source.pipe(createFrameSink((frame) => {
if (frame.type === 'TOOL_RESULT') console.log('Solutions:', frame.content.scoredIdeas);
if (frame.type === 'PROGRESS') console.log('Stage:', frame.content.phase);
}));
// Protocol growing for domain-specific TRIZ workflows
import { growTrizProtocol, defaultTrizProtocolSeeds } from '@polyweave/triz';
const result = growTrizProtocol({
domain: { name: 'biomedical', params: ['biocompatibility', 'sterilization'] },
seeds: defaultTrizProtocolSeeds,
scoringProfile: { /* custom weights */ }
});
Tests
npm test
Tests cover TRIZ tool creation and execution, contradiction detection with parameter mapping, inventive principle selection from the matrix, 3-No classification, DIKWP transformation proposals, semantic axiom verification, idea scoring across all dimensions, bt-harness integration, protocol growing, and multi-state evidence grounding.
Requirements
Node.js 18 or later. ESM only.
Caveats
- The TRIZ matrix lookup uses the classical 39×39 contradiction matrix. Non-standard contradictions or domains may require manual principle mapping.
- DIKWP transformations are LLM-generated and should be validated against domain-specific semantic axioms before production use.
- The package includes all TRIZ data tables (parameters, principles, matrix) as static data. These are reference implementations; extend or customize for specialized domains.
License
MIT
Dependencies
Dependencies
| ID | Version |
|---|---|
| @polyweave/bt-harness | * |
| @polyweave/core | * |
| @polyweave/creativity | * |
| @polyweave/nursery | * |
| @polyweave/sleuth | * |
| @polyweave/state | * |
| @polyweave/tools | * |
Development Dependencies
| ID | Version |
|---|---|
| @rigor/core | * |