flex-md 3.5.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +423 -39
  2. package/dist/index.cjs +62 -3
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +2 -0
  5. package/dist/md/parse.d.ts +1 -0
  6. package/dist/md/parse.js +12 -0
  7. package/dist/ofs/parser.js +31 -10
  8. package/dist/tokens/auto-fix.d.ts +10 -0
  9. package/dist/tokens/auto-fix.js +56 -0
  10. package/dist/tokens/cognitive-cost.d.ts +10 -0
  11. package/dist/tokens/cognitive-cost.js +205 -0
  12. package/dist/tokens/compliance.d.ts +10 -0
  13. package/dist/tokens/compliance.js +70 -0
  14. package/dist/tokens/confidence.d.ts +6 -0
  15. package/dist/tokens/confidence.js +332 -0
  16. package/dist/tokens/estimator.d.ts +12 -0
  17. package/dist/tokens/estimator.js +138 -0
  18. package/dist/tokens/improvements.d.ts +10 -0
  19. package/dist/tokens/improvements.js +697 -0
  20. package/dist/tokens/index.d.ts +24 -0
  21. package/dist/tokens/index.js +31 -0
  22. package/dist/tokens/parser.d.ts +3 -0
  23. package/dist/tokens/parser.js +97 -0
  24. package/dist/tokens/patterns.d.ts +9 -0
  25. package/dist/tokens/patterns.js +20 -0
  26. package/dist/tokens/smart-report.d.ts +10 -0
  27. package/dist/tokens/smart-report.js +187 -0
  28. package/dist/tokens/spec-estimator.d.ts +7 -0
  29. package/dist/tokens/spec-estimator.js +68 -0
  30. package/dist/tokens/types.d.ts +185 -0
  31. package/dist/tokens/validator.d.ts +16 -0
  32. package/dist/tokens/validator.js +59 -0
  33. package/docs/Recommended New Strategies for AI Request Builder.md +691 -0
  34. package/package.json +7 -3
  35. package/dist/detection/detector.d.ts +0 -6
  36. package/dist/detection/detector.js +0 -104
  37. package/dist/detection/extractor.d.ts +0 -10
  38. package/dist/detection/extractor.js +0 -54
  39. package/dist/issues/build.d.ts +0 -26
  40. package/dist/issues/build.js +0 -62
  41. package/dist/md/lists.d.ts +0 -14
  42. package/dist/md/lists.js +0 -33
  43. package/dist/md/tables.d.ts +0 -25
  44. package/dist/md/tables.js +0 -72
  45. package/dist/ofs/extractor.d.ts +0 -9
  46. package/dist/ofs/extractor.js +0 -75
  47. package/dist/ofs/issues.d.ts +0 -14
  48. package/dist/ofs/issues.js +0 -92
  49. package/dist/ofs/validator.d.ts +0 -10
  50. package/dist/ofs/validator.js +0 -91
  51. package/dist/outline/builder.d.ts +0 -10
  52. package/dist/outline/builder.js +0 -85
  53. package/dist/outline/renderer.d.ts +0 -6
  54. package/dist/outline/renderer.js +0 -23
  55. package/dist/parser.d.ts +0 -2
  56. package/dist/parser.js +0 -199
  57. package/dist/parsers/lists.d.ts +0 -6
  58. package/dist/parsers/lists.js +0 -36
  59. package/dist/parsers/tables.d.ts +0 -10
  60. package/dist/parsers/tables.js +0 -58
  61. package/dist/stringify.d.ts +0 -2
  62. package/dist/stringify.js +0 -110
  63. package/dist/test-pipeline.js +0 -53
  64. package/dist/test-runner.d.ts +0 -1
  65. package/dist/test-runner.js +0 -331
  66. package/dist/test-strictness.d.ts +0 -1
  67. package/dist/test-strictness.js +0 -213
  68. package/dist/util.d.ts +0 -5
  69. package/dist/util.js +0 -64
  70. package/dist/validate/policy.d.ts +0 -10
  71. package/dist/validate/policy.js +0 -17
  72. package/dist/validator.d.ts +0 -2
  73. package/dist/validator.js +0 -80
  74. /package/dist/{test-pipeline.d.ts → tokens/types.js} +0 -0
@@ -0,0 +1,691 @@
1
+ # Recommended New Strategies for AI Request Builder
2
+
3
+ Based on different task categories, here are strategic additions that would significantly improve the RequestBuilder's versatility:
4
+
5
+ ---
6
+
7
+ ## 1. **`checklist-driven`** Strategy
8
+ **Best for:** Audit tasks, quality checks, compliance reviews, evaluation tasks
9
+
10
+ ### Concept
11
+ Uses explicit checklists and criteria to guide LLM reasoning, ensuring comprehensive coverage and systematic evaluation.
12
+
13
+ ### Required Inputs (Tokens)
14
+ ```typescript
15
+ {
16
+ checklistItems: string[]; // Array of specific things to check/verify
17
+ evaluationCriteria: {
18
+ criterion: string;
19
+ weight?: number; // Optional scoring weight
20
+ requiredEvidence?: string; // What evidence is needed
21
+ }[];
22
+ scoringRubric?: {
23
+ excellent: string;
24
+ good: string;
25
+ fair: string;
26
+ poor: string;
27
+ };
28
+ mustCheckAll: boolean; // Whether all items must be addressed
29
+ }
30
+ ```
31
+
32
+ ### System Message Structure
33
+ ```
34
+ You are performing a systematic audit/evaluation task.
35
+
36
+ EVALUATION CRITERIA:
37
+ {evaluationCriteria formatted as numbered list}
38
+
39
+ CHECKLIST (must verify each):
40
+ {checklistItems formatted with checkboxes}
41
+
42
+ SCORING RUBRIC:
43
+ {scoringRubric if provided}
44
+
45
+ PROCESS:
46
+ 1. Review each checklist item systematically
47
+ 2. Gather evidence for each criterion
48
+ 3. Score against the rubric
49
+ 4. Document findings with specific references
50
+
51
+ {schema guidance}
52
+ ```
53
+
54
+ ### Output Schema Requirements
55
+ Must include:
56
+ - `checklistResults: { item: string; status: 'pass'|'fail'|'warning'; evidence: string }[]`
57
+ - `criteriaScores: { criterion: string; score: number; justification: string }[]`
58
+ - `overallAssessment: string`
59
+ - `recommendations: string[]`
60
+
61
+ ---
62
+
63
+ ## 2. **`chain-of-thought`** Strategy
64
+ **Best for:** Complex reasoning, math problems, multi-step analysis, debugging
65
+
66
+ ### Concept
67
+ Encourages explicit step-by-step reasoning before producing final output. Shows work and intermediate conclusions.
68
+
69
+ ### Required Inputs (Tokens)
70
+ ```typescript
71
+ {
72
+ reasoningPrompt?: string; // Custom reasoning instruction
73
+ requireExplicitSteps: boolean;
74
+ minimumReasoningSteps?: number;
75
+ showIntermediateWork: boolean;
76
+ verificationStep?: string; // Optional: "verify your answer by..."
77
+ }
78
+ ```
79
+
80
+ ### System Message Structure
81
+ ```
82
+ {instructions}
83
+
84
+ REASONING APPROACH:
85
+ Before providing your final answer, you must:
86
+ 1. Break down the problem/task into clear steps
87
+ 2. Work through each step explicitly, showing your reasoning
88
+ 3. State intermediate conclusions
89
+ 4. {verificationStep if provided}
90
+ 5. Provide final answer based on your reasoning
91
+
92
+ {schema guidance with reasoning field}
93
+ ```
94
+
95
+ ### Output Schema Requirements
96
+ Must include:
97
+ - `reasoning: { step: number; description: string; conclusion: string }[]`
98
+ - `finalAnswer: {actual output fields}`
99
+ - `confidenceLevel?: 'high' | 'medium' | 'low'`
100
+
101
+ ---
102
+
103
+ ## 3. **`citation-grounded`** Strategy
104
+ **Best for:** Research summaries, fact-checking, question answering with sources
105
+
106
+ ### Concept
107
+ Forces LLM to cite sources for every claim and distinguish between source content and inference.
108
+
109
+ ### Required Inputs (Tokens)
110
+ ```typescript
111
+ {
112
+ sources: {
113
+ id: string;
114
+ title: string;
115
+ content: string;
116
+ metadata?: Record<string, any>;
117
+ }[];
118
+ requireCitationFor: 'all' | 'facts' | 'statistics' | 'quotes';
119
+ allowInference: boolean;
120
+ citationFormat: 'inline' | 'footnote' | 'structured';
121
+ }
122
+ ```
123
+
124
+ ### System Message Structure
125
+ ```
126
+ {instructions}
127
+
128
+ SOURCES PROVIDED:
129
+ {sources formatted with IDs}
130
+
131
+ CITATION REQUIREMENTS:
132
+ - Every factual claim must reference a source using [source_id]
133
+ - Clearly distinguish between:
134
+ * Direct information from sources (cite with [source_id])
135
+ * Your inferences (mark as "Inference:")
136
+ * Uncertain information (mark as "Unclear from sources:")
137
+ - Do not make claims without source support
138
+ - If sources conflict, note the discrepancy
139
+
140
+ {schema guidance}
141
+ ```
142
+
143
+ ### Output Schema Requirements
144
+ ```typescript
145
+ {
146
+ answer: string; // Main response with inline citations
147
+ citations: {
148
+ sourceId: string;
149
+ relevantExcerpt: string;
150
+ pageNumber?: number;
151
+ }[];
152
+ inferences: string[]; // Explicit list of inferences made
153
+ uncertainties: string[]; // What couldn't be determined
154
+ sourceConflicts?: { claim: string; sources: string[] }[];
155
+ }
156
+ ```
157
+
158
+ ---
159
+
160
+ ## 4. **`style-guided`** Strategy
161
+ **Best for:** Content writing, marketing copy, documentation, creative writing
162
+
163
+ ### Concept
164
+ Uses explicit style guidelines and tone tokens to match desired voice and format.
165
+
166
+ ### Required Inputs (Tokens)
167
+ ```typescript
168
+ {
169
+ tone: 'formal' | 'casual' | 'technical' | 'persuasive' | 'empathetic' | 'humorous' | string;
170
+ audience: string; // "technical developers", "C-suite executives", "general public"
171
+ styleGuide: {
172
+ voiceCharacteristics: string[]; // ["conversational", "authoritative"]
173
+ avoidPhrases: string[]; // Phrases to avoid
174
+ preferredPhrases: string[]; // Preferred expressions
175
+ sentenceLength: 'short' | 'medium' | 'long' | 'varied';
176
+ vocabularyLevel: 'simple' | 'intermediate' | 'advanced' | 'domain-specific';
177
+ };
178
+ brandVoice?: {
179
+ personality: string[]; // ["friendly", "innovative", "trustworthy"]
180
+ writingRules: string[]; // ["use active voice", "avoid jargon"]
181
+ };
182
+ formatRequirements?: {
183
+ structure: string; // "introduction, body, conclusion"
184
+ maxLength?: number;
185
+ includeElements?: string[]; // ["call-to-action", "statistics", "quotes"]
186
+ };
187
+ }
188
+ ```
189
+
190
+ ### System Message Structure
191
+ ```
192
+ {instructions}
193
+
194
+ STYLE REQUIREMENTS:
195
+ Tone: {tone}
196
+ Audience: {audience}
197
+
198
+ VOICE CHARACTERISTICS:
199
+ {voiceCharacteristics as bullets}
200
+
201
+ WRITING GUIDELINES:
202
+ ✓ DO: {preferredPhrases}
203
+ ✗ AVOID: {avoidPhrases}
204
+ - Sentence Length: {sentenceLength}
205
+ - Vocabulary: {vocabularyLevel}
206
+
207
+ {brandVoice if provided}
208
+
209
+ FORMAT:
210
+ {formatRequirements}
211
+
212
+ {schema guidance}
213
+ ```
214
+
215
+ ### Output Schema Requirements
216
+ ```typescript
217
+ {
218
+ content: string;
219
+ wordCount: number;
220
+ styleCompliance: {
221
+ toneMatch: 'high' | 'medium' | 'low';
222
+ audienceAppropriate: boolean;
223
+ guidelinesFollowed: string[];
224
+ guidelinesViolated: string[];
225
+ };
226
+ suggestedImprovements?: string[];
227
+ }
228
+ ```
229
+
230
+ ---
231
+
232
+ ## 5. **`decomposition-first`** Strategy
233
+ **Best for:** Outlines, project planning, complex task breakdown
234
+
235
+ ### Concept
236
+ Forces LLM to first decompose the task into components before executing, ensuring logical structure.
237
+
238
+ ### Required Inputs (Tokens)
239
+ ```typescript
240
+ {
241
+ decompositionLevel: 'high-level' | 'detailed' | 'granular';
242
+ hierarchyDepth: number; // How many levels deep
243
+ requireDependencies: boolean; // Track dependencies between components
244
+ estimationRequired: boolean; // Require time/effort estimates
245
+ decompositionCriteria?: {
246
+ maxComponentsPerLevel: number;
247
+ minComponentsPerLevel: number;
248
+ balanceStrategy: 'even' | 'by-complexity' | 'by-priority';
249
+ };
250
+ }
251
+ ```
252
+
253
+ ### System Message Structure
254
+ ```
255
+ {instructions}
256
+
257
+ DECOMPOSITION PROCESS:
258
+ Phase 1: BREAK DOWN THE TASK
259
+ 1. Identify the main objective
260
+ 2. Decompose into {hierarchyDepth} levels of sub-components
261
+ 3. {if requireDependencies: "Map dependencies between components"}
262
+ 4. {if estimationRequired: "Estimate effort/time for each"}
263
+
264
+ Phase 2: VALIDATE STRUCTURE
265
+ - Ensure completeness (nothing missing)
266
+ - Check for logical flow
267
+ - Verify hierarchy makes sense
268
+
269
+ Phase 3: PRODUCE OUTPUT
270
+ Format your decomposition according to the schema.
271
+
272
+ DECOMPOSITION CRITERIA:
273
+ {decompositionCriteria}
274
+
275
+ {schema guidance}
276
+ ```
277
+
278
+ ### Output Schema Requirements
279
+ ```typescript
280
+ {
281
+ objective: string;
282
+ decomposition: {
283
+ id: string;
284
+ level: number;
285
+ parentId?: string;
286
+ title: string;
287
+ description: string;
288
+ dependencies?: string[]; // IDs of components this depends on
289
+ estimatedEffort?: string;
290
+ priority?: 'high' | 'medium' | 'low';
291
+ children?: DecompositionNode[];
292
+ }[];
293
+ completenessCheck: {
294
+ allAreasCovered: boolean;
295
+ gaps: string[];
296
+ };
297
+ suggestedOrder?: string[]; // Optimal execution order considering dependencies
298
+ }
299
+ ```
300
+
301
+ ---
302
+
303
+ ## 6. **`constraint-creative`** Strategy
304
+ **Best for:** Creative writing, brainstorming, design tasks with guardrails
305
+
306
+ ### Concept
307
+ Balances creativity with explicit constraints to guide output while maintaining originality.
308
+
309
+ ### Required Inputs (Tokens)
310
+ ```typescript
311
+ {
312
+ creativityLevel: 'conservative' | 'moderate' | 'experimental';
313
+ hardConstraints: string[]; // Must-follow rules
314
+ softConstraints: string[]; // Preferences, can bend if needed
315
+ inspirationSources?: string[]; // Reference materials
316
+ avoidClichés: string[]; // Overused patterns to avoid
317
+ requiredElements?: string[]; // Must include these
318
+ forbiddenElements?: string[]; // Must not include these
319
+ noveltyRequirement: 'highly-original' | 'somewhat-original' | 'conventional';
320
+ }
321
+ ```
322
+
323
+ ### System Message Structure
324
+ ```
325
+ {instructions}
326
+
327
+ CREATIVE BRIEF:
328
+ Creativity Level: {creativityLevel}
329
+ Novelty Requirement: {noveltyRequirement}
330
+
331
+ HARD CONSTRAINTS (must follow):
332
+ {hardConstraints}
333
+
334
+ SOFT CONSTRAINTS (preferred):
335
+ {softConstraints}
336
+
337
+ REQUIRED ELEMENTS:
338
+ {requiredElements}
339
+
340
+ AVOID:
341
+ - Clichés: {avoidClichés}
342
+ - Forbidden: {forbiddenElements}
343
+
344
+ {inspirationSources if provided}
345
+
346
+ CREATIVE PROCESS:
347
+ 1. Generate multiple concepts
348
+ 2. Evaluate against constraints
349
+ 3. Select most promising + original
350
+ 4. Refine and develop
351
+
352
+ {schema guidance}
353
+ ```
354
+
355
+ ### Output Schema Requirements
356
+ ```typescript
357
+ {
358
+ primaryOutput: string; // Main creative work
359
+ alternativeConcepts: string[]; // 2-3 alternatives considered
360
+ constraintCompliance: {
361
+ hardConstraintsMet: boolean;
362
+ softConstraintsScore: number; // 0-100
363
+ violations: string[];
364
+ };
365
+ noveltyScore: number; // Self-assessed 0-100
366
+ creativeRationale: string; // Why this approach was chosen
367
+ }
368
+ ```
369
+
370
+ ---
371
+
372
+ ## 7. **`test-driven`** Strategy
373
+ **Best for:** Code generation, algorithm design, function creation
374
+
375
+ ### Concept
376
+ Requires thinking about test cases and edge cases before generating code.
377
+
378
+ ### Required Inputs (Tokens)
379
+ ```typescript
380
+ {
381
+ testCases: {
382
+ input: any;
383
+ expectedOutput: any;
384
+ description: string;
385
+ }[];
386
+ edgeCases?: string[]; // Descriptions of edge cases to handle
387
+ performanceRequirements?: {
388
+ timeComplexity?: string; // "O(n)", "O(log n)"
389
+ spaceComplexity?: string;
390
+ maxExecutionTime?: number; // milliseconds
391
+ };
392
+ codeStandards?: {
393
+ language: string;
394
+ framework?: string;
395
+ style: string; // "functional", "object-oriented"
396
+ requireDocumentation: boolean;
397
+ requireTypeAnnotations: boolean;
398
+ };
399
+ }
400
+ ```
401
+
402
+ ### System Message Structure
403
+ ```
404
+ {instructions}
405
+
406
+ TEST-DRIVEN DEVELOPMENT APPROACH:
407
+
408
+ PROVIDED TEST CASES:
409
+ {testCases formatted}
410
+
411
+ EDGE CASES TO HANDLE:
412
+ {edgeCases}
413
+
414
+ PERFORMANCE REQUIREMENTS:
415
+ {performanceRequirements}
416
+
417
+ CODE STANDARDS:
418
+ {codeStandards}
419
+
420
+ PROCESS:
421
+ 1. Analyze test cases to understand requirements
422
+ 2. Identify edge cases and error scenarios
423
+ 3. Design solution approach
424
+ 4. Implement with test cases in mind
425
+ 5. Verify logic against all test cases
426
+ 6. Document assumptions and limitations
427
+
428
+ {schema guidance}
429
+ ```
430
+
431
+ ### Output Schema Requirements
432
+ ```typescript
433
+ {
434
+ code: string;
435
+ language: string;
436
+ testCoverage: {
437
+ testCase: string;
438
+ passes: boolean;
439
+ explanation: string;
440
+ }[];
441
+ edgeCasesHandled: string[];
442
+ assumptions: string[];
443
+ knownLimitations: string[];
444
+ documentation: string;
445
+ performanceAnalysis?: {
446
+ timeComplexity: string;
447
+ spaceComplexity: string;
448
+ rationale: string;
449
+ };
450
+ }
451
+ ```
452
+
453
+ ---
454
+
455
+ ## 8. **`comparative-analysis`** Strategy
456
+ **Best for:** Compare options, decision support, versus analysis
457
+
458
+ ### Concept
459
+ Structured comparison across multiple dimensions with explicit criteria.
460
+
461
+ ### Required Inputs (Tokens)
462
+ ```typescript
463
+ {
464
+ subjects: string[]; // Things being compared
465
+ dimensions: {
466
+ name: string;
467
+ description: string;
468
+ weight?: number; // Importance weight
469
+ scoringMethod: 'quantitative' | 'qualitative' | 'binary';
470
+ }[];
471
+ decisionCriteria?: {
472
+ dealBreakers?: string[]; // Automatic disqualifiers
473
+ niceToHave?: string[];
474
+ priorities?: string[];
475
+ };
476
+ outputFormat: 'matrix' | 'narrative' | 'scorecard';
477
+ }
478
+ ```
479
+
480
+ ### System Message Structure
481
+ ```
482
+ {instructions}
483
+
484
+ COMPARISON TASK:
485
+ Subjects: {subjects}
486
+
487
+ DIMENSIONS OF COMPARISON:
488
+ {dimensions with weights}
489
+
490
+ DECISION CRITERIA:
491
+ {decisionCriteria}
492
+
493
+ ANALYSIS APPROACH:
494
+ 1. Evaluate each subject across all dimensions
495
+ 2. Use consistent scoring method
496
+ 3. Weight dimensions appropriately
497
+ 4. Provide evidence for assessments
498
+ 5. Identify clear winner(s) if applicable
499
+ 6. Note trade-offs and considerations
500
+
501
+ OUTPUT FORMAT: {outputFormat}
502
+
503
+ {schema guidance}
504
+ ```
505
+
506
+ ### Output Schema Requirements
507
+ ```typescript
508
+ {
509
+ comparisonMatrix: {
510
+ subject: string;
511
+ scores: {
512
+ dimension: string;
513
+ score: number | string;
514
+ evidence: string;
515
+ confidence: 'high' | 'medium' | 'low';
516
+ }[];
517
+ totalScore?: number;
518
+ rank?: number;
519
+ }[];
520
+ recommendation: {
521
+ topChoice: string;
522
+ rationale: string;
523
+ tradeOffs: string[];
524
+ contextualFactors: string[];
525
+ };
526
+ alternativeScenarios?: {
527
+ scenario: string;
528
+ recommendation: string;
529
+ }[];
530
+ }
531
+ ```
532
+
533
+ ---
534
+
535
+ ## 9. **`iterative-refinement`** Strategy (Multi-turn)
536
+ **Best for:** Draft improvement, editing, progressive enhancement
537
+
538
+ ### Concept
539
+ Explicit multi-stage process where LLM produces, critiques, then refines its own output.
540
+
541
+ ### Required Inputs (Tokens)
542
+ ```typescript
543
+ {
544
+ refinementCycles: number; // How many improve iterations
545
+ critiqueCriteria: string[]; // What to look for in critique
546
+ improvementFocus: string[]; // "clarity", "conciseness", "accuracy"
547
+ preserveAspects?: string[]; // What should NOT change
548
+ targetQualityLevel: 'publication-ready' | 'review-ready' | 'draft';
549
+ }
550
+ ```
551
+
552
+ ### System Message Structure
553
+ ```
554
+ {instructions}
555
+
556
+ ITERATIVE REFINEMENT PROCESS:
557
+
558
+ You will go through {refinementCycles} cycles:
559
+
560
+ CYCLE STRUCTURE:
561
+ 1. Produce (or Revise)
562
+ 2. Critique against: {critiqueCriteria}
563
+ 3. Identify improvements for: {improvementFocus}
564
+ 4. Preserve: {preserveAspects}
565
+ 5. Refine
566
+
567
+ Target Quality: {targetQualityLevel}
568
+
569
+ Show all iterations in your output.
570
+
571
+ {schema guidance}
572
+ ```
573
+
574
+ ### Output Schema Requirements
575
+ ```typescript
576
+ {
577
+ iterations: {
578
+ cycle: number;
579
+ output: string;
580
+ critique: {
581
+ strengths: string[];
582
+ weaknesses: string[];
583
+ specificIssues: string[];
584
+ };
585
+ improvements: string[];
586
+ }[];
587
+ finalOutput: string;
588
+ qualityAssessment: {
589
+ meetsTarget: boolean;
590
+ remainingIssues: string[];
591
+ confidenceLevel: number;
592
+ };
593
+ }
594
+ ```
595
+
596
+ ---
597
+
598
+ ## 10. **`socratic-reasoning`** Strategy
599
+ **Best for:** Educational content, question answering, knowledge exploration
600
+
601
+ ### Concept
602
+ Guides user understanding through questions and gradual revelation rather than direct answers.
603
+
604
+ ### Required Inputs (Tokens)
605
+ ```typescript
606
+ {
607
+ pedagogicalApproach: 'guided-discovery' | 'scaffolded' | 'exploratory';
608
+ questionDepth: 'surface' | 'moderate' | 'deep';
609
+ provideFinalAnswer: boolean;
610
+ knowledgeLevel: string; // "beginner", "intermediate", "advanced"
611
+ learningObjectives?: string[];
612
+ }
613
+ ```
614
+
615
+ ### System Message Structure
616
+ ```
617
+ {instructions}
618
+
619
+ SOCRATIC METHOD:
620
+ Your goal is to guide understanding, not just provide answers.
621
+
622
+ Approach: {pedagogicalApproach}
623
+ Question Depth: {questionDepth}
624
+ Learner Level: {knowledgeLevel}
625
+
626
+ STRUCTURE YOUR RESPONSE:
627
+ 1. Ask clarifying questions to assess understanding
628
+ 2. Guide thinking with strategic questions
629
+ 3. Provide hints and scaffolding
630
+ 4. Allow discovery
631
+ 5. {if provideFinalAnswer: "Conclude with clear answer"}
632
+
633
+ Learning Objectives: {learningObjectives}
634
+
635
+ {schema guidance}
636
+ ```
637
+
638
+ ### Output Schema Requirements
639
+ ```typescript
640
+ {
641
+ guidingQuestions: string[];
642
+ hints: {
643
+ level: 'subtle' | 'moderate' | 'direct';
644
+ content: string;
645
+ }[];
646
+ conceptsToExplore: string[];
647
+ finalExplanation?: string;
648
+ additionalResources?: string[];
649
+ assessmentQuestion?: string; // To check understanding
650
+ }
651
+ ```
652
+
653
+ ---
654
+
655
+ ## Implementation Notes
656
+
657
+ ### Strategy Selection Logic
658
+ Add to `RequestBuilder`:
659
+
660
+ ```typescript
661
+ interface StrategyContext {
662
+ taskType?: 'audit' | 'analysis' | 'writing' | 'code' | 'planning' | 'qa' | 'creative';
663
+ complexityLevel?: 'simple' | 'moderate' | 'complex';
664
+ requiresReasoning?: boolean;
665
+ requiresSources?: boolean;
666
+ iterative?: boolean;
667
+ }
668
+
669
+ // Auto-suggest strategy based on context
670
+ function suggestStrategy(context: StrategyContext): string;
671
+ ```
672
+
673
+ ### Token Resolution Enhancement
674
+ Support nested token structures:
675
+ ```typescript
676
+ {
677
+ strategy: 'checklist-driven',
678
+ strategyConfig: {
679
+ checklistItems: [...],
680
+ evaluationCriteria: [...]
681
+ }
682
+ }
683
+ ```
684
+
685
+ ### Validation
686
+ Each strategy should validate required tokens are provided:
687
+ ```typescript
688
+ validateStrategyInputs(strategy: string, request: BuildMessageRequest): ValidationResult
689
+ ```
690
+
691
+ These strategies cover a much wider range of use cases while maintaining the structured, reliable approach that makes the RequestBuilder valuable. Each can be mixed with the existing few-shot or task-first patterns for maximum effectiveness.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flex-md",
3
- "version": "3.5.0",
3
+ "version": "4.1.0",
4
4
  "description": "Parse and stringify FlexMD: semi-structured Markdown with three powerful layers - Frames, Output Format Spec (OFS), and Detection/Extraction.",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -37,13 +37,17 @@
37
37
  "SPEC.md"
38
38
  ],
39
39
  "scripts": {
40
- "build": "tsc && node ./scripts/cjs-bridge.mjs",
40
+ "build": "tsc && tsc -p tsconfig.cjs.json && node ./scripts/cjs-bridge.mjs",
41
41
  "test": "vitest run",
42
- "test:watch": "vitest"
42
+ "test:watch": "vitest",
43
+ "test:smoke": "node test/smoke-require.cjs && node test/smoke-import.mjs"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@types/node": "^25.0.3",
46
47
  "typescript": "^5.6.3",
47
48
  "vitest": "^4.0.16"
49
+ },
50
+ "dependencies": {
51
+ "nx-helpers": "^1.5.0"
48
52
  }
49
53
  }
@@ -1,6 +0,0 @@
1
- import type { DetectedObject } from "../types.js";
2
- /**
3
- * Detect FlexMD and other structured objects in arbitrary text.
4
- * Returns all detected objects with confidence scores and byte ranges.
5
- */
6
- export declare function detectObjects(text: string): DetectedObject[];