MCPcopy Create free account
hub / github.com/IAmUnbounded/devctx / extractDecisions

Function extractDecisions

devctx/src/core/parser.ts:511–533  ·  view source on GitHub ↗
(messages: string[])

Source from the content-addressed store, hash-verified

509}
510
511function extractDecisions(messages: string[]): string[] {
512 const decisions: string[] = [];
513 const patterns = [
514 /(?:decided|choosing|using|going with|switched to|picked)\s+(.+?)(?:\.|$)/gi,
515 /(?:decision|chose|selected|opted for)\s*:?\s*(.+?)(?:\.|$)/gi,
516 ];
517
518 for (const msg of messages.slice(-10)) {
519 const sentences = msg.split(/[.!?]\s+/);
520 for (const sentence of sentences) {
521 // Use more flexible matching for decision verbs (decided, choosing, etc.)
522 if (sentence.match(/\b(decid|chos|opt|select|prefer|us(?:e|ing)|going with|approach|architect|pattern|instead of)/i)) {
523 const cleaned = sentence.trim();
524 // Avoid very short fragments
525 if (cleaned.length > 20 && cleaned.length < 300 && !decisions.includes(cleaned)) {
526 decisions.push(cleaned);
527 }
528 }
529 }
530 }
531
532 return decisions.slice(0, 10);
533}
534
535function extractApproaches(messages: string[]): string[] {
536 const approaches: string[] = [];

Callers 1

parseClaudeSessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected