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

Function extractApproaches

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

Source from the content-addressed store, hash-verified

533}
534
535function extractApproaches(messages: string[]): string[] {
536 const approaches: string[] = [];
537 const patterns = [
538 /(?:tried|approach|attempted|tested|experimented with)\s+(.+?)(?:\.|$)/gi,
539 /(?:first|then|alternatively|instead)\s*,?\s*(?:I|we|let's)\s+(.+?)(?:\.|$)/gi,
540 ];
541
542 for (const msg of messages.slice(-10)) {
543 for (const pattern of patterns) {
544 pattern.lastIndex = 0;
545 let match: RegExpExecArray | null;
546 while ((match = pattern.exec(msg)) !== null) {
547 const a = match[0].trim();
548 if (a.length > 10 && a.length < 200 && !approaches.includes(a)) {
549 approaches.push(a);
550 }
551 }
552 }
553 }
554
555 return approaches.slice(0, 8);
556}
557
558function extractState(messages: string[]): string {
559 // Look at last assistant message for state

Callers 1

parseClaudeSessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected