📦 deps(thirdparty): update snapshots
This commit is contained in:
+854
@@ -0,0 +1,854 @@
|
||||
# Extraction Techniques
|
||||
|
||||
Technical methods for extracting signals from conversation history, including regex patterns, heuristics, and context analysis.
|
||||
|
||||
## Signal Detection Patterns
|
||||
|
||||
### Success Signals
|
||||
|
||||
#### Explicit Praise Detection
|
||||
|
||||
**Regex patterns**:
|
||||
|
||||
```regex
|
||||
# High confidence praise
|
||||
\b(perfect|excellent|exactly|amazing|brilliant|outstanding|superb)\b!*
|
||||
|
||||
# Medium confidence praise
|
||||
\b(great|good|nice|wonderful|fantastic)\b
|
||||
|
||||
# Superlatives
|
||||
\b(best|ideal|optimal|precisely)\s+(what|how|where)\s+
|
||||
|
||||
# Enthusiastic patterns
|
||||
!{2,}|🎉|👍|✅
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. Check for exclamation marks: 1 = medium confidence, 2+ = high confidence
|
||||
2. Count positive adjectives in message: 2+ = high enthusiasm
|
||||
3. Check for "exactly what I needed" or similar fulfillment language
|
||||
4. Verify no contradictory signals in same message (e.g., "good but...")
|
||||
|
||||
**Context checks**:
|
||||
|
||||
```
|
||||
If praise detected:
|
||||
- Check previous agent message: What did agent do?
|
||||
- Check next user message: Did user continue or correct?
|
||||
- Score based on continuation vs. correction
|
||||
```
|
||||
|
||||
#### Continuation Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Explicit continuation
|
||||
\bnow\s+(do|apply|use|add|implement)\s+
|
||||
\bapply\s+this\s+(to|pattern|approach)\s+
|
||||
\bnext[,\s]+(let's|do|add)
|
||||
|
||||
# Extension language
|
||||
\b(also|additionally|furthermore|moreover)\s+
|
||||
\bsame\s+(for|with|to)\b
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. Check if message references "this", "that", "same" without corrections
|
||||
2. Verify previous agent message exists (continuation requires prior context)
|
||||
3. Check for negation words: "now do X instead" is correction, not continuation
|
||||
4. Look for expansion keywords: "also", "and", "too", "as well"
|
||||
|
||||
**Context checks**:
|
||||
|
||||
```
|
||||
If continuation suspected:
|
||||
- Extract referenced prior work (parse "this", "that", "same")
|
||||
- Check for corrections between reference and current message
|
||||
- If corrections exist: Not continuation (likely correction signal)
|
||||
- If no corrections: Continuation (confidence based on explicitness)
|
||||
```
|
||||
|
||||
#### Adoption Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
This is primarily behavioral, not linguistic. Requires analyzing agent suggestions vs. user actions.
|
||||
|
||||
```
|
||||
Detection algorithm:
|
||||
1. Extract agent's suggestions from previous messages
|
||||
2. Check user's next message or code changes
|
||||
3. If user implements suggestion without modification:
|
||||
- Adoption signal (high confidence)
|
||||
4. If user asks clarifying questions then implements:
|
||||
- Adoption signal (medium confidence)
|
||||
5. If user modifies before implementing:
|
||||
- Partial adoption (low confidence) or correction signal
|
||||
```
|
||||
|
||||
**Code comparison heuristic**:
|
||||
|
||||
```javascript
|
||||
// Pseudocode for adoption detection
|
||||
function detectAdoption(agentMessage, userResponse) {
|
||||
const agentSuggestions = extractSuggestions(agentMessage);
|
||||
const userActions = extractActions(userResponse);
|
||||
|
||||
for (const suggestion of agentSuggestions) {
|
||||
const match = findMatchingAction(suggestion, userActions);
|
||||
if (match && match.similarity > 0.8) {
|
||||
return { signal: 'adoption', confidence: 'high' };
|
||||
} else if (match && match.similarity > 0.5) {
|
||||
return { signal: 'adoption', confidence: 'medium' };
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
```
|
||||
|
||||
### Frustration Signals
|
||||
|
||||
#### Correction Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Explicit negation
|
||||
\b(no[,\s]|wrong|incorrect|not\s+what|that's\s+not)\b
|
||||
|
||||
# Correction language
|
||||
\b(actually|instead|rather)\s+
|
||||
\bI\s+meant\s+
|
||||
\bdo\s+\w+\s+instead\b
|
||||
|
||||
# Contradiction markers
|
||||
\bdon't\s+do\s+\w+
|
||||
\bnot\s+\w+[,\s]+\w+
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. Check for negation words followed by agent's previous output
|
||||
2. Look for "instead" patterns: "X instead of Y" where Y was agent's choice
|
||||
3. Check for contradiction: "I said X" where X contradicts recent agent action
|
||||
4. Verify correction vs. iteration: correction references agent error, iteration builds on success
|
||||
|
||||
**Context checks**:
|
||||
|
||||
```
|
||||
If correction suspected:
|
||||
- Extract what user is correcting (X → Y)
|
||||
- Check if agent did X in previous message
|
||||
- If yes: Correction signal (confidence based on negation strength)
|
||||
- If no: Possible misunderstanding or false positive
|
||||
```
|
||||
|
||||
#### Repetition Detection
|
||||
|
||||
**Pattern**:
|
||||
|
||||
This requires multi-message analysis.
|
||||
|
||||
```
|
||||
Detection algorithm:
|
||||
1. Extract normalized intent from each user message
|
||||
2. Build similarity matrix across messages
|
||||
3. Find clusters of high-similarity messages (>0.7 similarity)
|
||||
4. If cluster size >= 2 and spans multiple agent responses:
|
||||
- Repetition signal
|
||||
5. Check for escalation language ("again", "already told you"):
|
||||
- High confidence
|
||||
6. Otherwise: Medium confidence
|
||||
```
|
||||
|
||||
**Normalization steps**:
|
||||
|
||||
```javascript
|
||||
function normalizeIntent(message) {
|
||||
// Remove politeness/filler
|
||||
let normalized = message.toLowerCase();
|
||||
normalized = normalized.replace(/\b(please|thanks|thank you)\b/g, '');
|
||||
|
||||
// Extract core imperative
|
||||
const imperatives = normalized.match(/\b(use|do|make|add|implement|fix)\s+\w+/g);
|
||||
|
||||
// Extract prohibitions
|
||||
const prohibitions = normalized.match(/\bdon't\s+\w+/g);
|
||||
|
||||
return { imperatives, prohibitions };
|
||||
}
|
||||
|
||||
function calculateSimilarity(intent1, intent2) {
|
||||
// Check for matching imperatives or prohibitions
|
||||
// Return similarity score 0.0 - 1.0
|
||||
}
|
||||
```
|
||||
|
||||
**Escalation markers**:
|
||||
|
||||
```regex
|
||||
\b(again|once again|already|I\s+told\s+you|I\s+said|still)\b
|
||||
```
|
||||
|
||||
#### Explicit Frustration Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Direct frustration language
|
||||
\b(frustrat(ing|ed)|annoying|annoyed|confusion|confused)\b
|
||||
|
||||
# Problem statements
|
||||
\b(not\s+working|doesn't\s+work|broken|failing|fails)\b
|
||||
|
||||
# Accusatory questions
|
||||
\bwhy\s+(did|would|do)\s+you\s+
|
||||
|
||||
# Exasperation
|
||||
\bcome\s+on\b|\bseriously\b|\breally\?\b
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. Question marks with negative tone: medium frustration
|
||||
2. Multiple question marks: high frustration
|
||||
3. All caps words: high frustration
|
||||
4. Repetition of negative words: escalating frustration
|
||||
|
||||
**Tone analysis**:
|
||||
|
||||
```javascript
|
||||
function analyzeTone(message) {
|
||||
const negativeWords = message.match(/\b(not|no|never|don't|can't|won't)\b/g);
|
||||
const negativeWordCount = negativeWords ? negativeWords.length : 0;
|
||||
|
||||
const questionMarks = message.match(/\?/g);
|
||||
const questionCount = questionMarks ? questionMarks.length : 0;
|
||||
|
||||
const capsWords = message.match(/\b[A-Z]{2,}\b/g);
|
||||
const capsCount = capsWords ? capsWords.length : 0;
|
||||
|
||||
// Frustration score
|
||||
const score = (negativeWordCount * 0.3) + (questionCount * 0.2) + (capsCount * 0.5);
|
||||
|
||||
if (score > 1.5) return 'high';
|
||||
if (score > 0.7) return 'medium';
|
||||
return 'low';
|
||||
}
|
||||
```
|
||||
|
||||
### Workflow Signals
|
||||
|
||||
#### Sequence Marker Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Ordinal markers
|
||||
\b(first|second|third|fourth|fifth)\b[,\s]
|
||||
\b(1st|2nd|3rd|4th|5th)\b[,\s]
|
||||
\bstep\s+\d+[:\s]
|
||||
|
||||
# Temporal sequence
|
||||
\b(before|after|then|next|finally)\b[,\s]
|
||||
\bonce\s+\w+[,\s]+(then|do|we)\b
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. Count ordinal markers: 2+ = high confidence sequence
|
||||
2. Check for numbered lists (1., 2., 3.)
|
||||
3. Look for temporal connectives in order (first...then...finally)
|
||||
4. Verify sequence is prescriptive (steps to take) not descriptive (events that happened)
|
||||
|
||||
**List detection**:
|
||||
|
||||
```javascript
|
||||
function detectSequence(message) {
|
||||
// Check for numbered list
|
||||
const numberedItems = message.match(/^\d+\.\s+.+$/gm);
|
||||
if (numberedItems && numberedItems.length >= 2) {
|
||||
return { signal: 'sequence', confidence: 'high', items: numberedItems };
|
||||
}
|
||||
|
||||
// Check for ordinal markers
|
||||
const ordinals = message.match(/\b(first|second|third|then|next|finally)\b/gi);
|
||||
if (ordinals && ordinals.length >= 2) {
|
||||
return { signal: 'sequence', confidence: 'medium', markers: ordinals };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
```
|
||||
|
||||
#### Stage Transition Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Completion + new direction
|
||||
\b(now\s+that|with\s+that|that's\s+done)\b.+\b(let's|next|moving|time\s+to)\b
|
||||
|
||||
# Explicit transitions
|
||||
\bmoving\s+on\s+to\b
|
||||
\bnext\s+up[:\s]
|
||||
\bswitching\s+to\b
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. Check for completion language: "done", "finished", "complete", "that's it"
|
||||
2. Check for new direction: "now", "next", "let's", "time to"
|
||||
3. Must have both completion and new direction for high confidence
|
||||
4. If only new direction: context switch, not stage transition
|
||||
|
||||
**Context checks**:
|
||||
|
||||
```
|
||||
If stage transition suspected:
|
||||
- Check if previous task mentioned in completion language
|
||||
- Verify previous task was in progress (not already complete)
|
||||
- Check if new direction is related (stage) or unrelated (context switch)
|
||||
- Related = stage transition, unrelated = context switch
|
||||
```
|
||||
|
||||
#### Tool Chain Detection
|
||||
|
||||
**Pattern**:
|
||||
|
||||
Requires analyzing agent's tool usage across multiple tasks.
|
||||
|
||||
```
|
||||
Detection algorithm:
|
||||
1. Extract tool call sequences from agent messages
|
||||
2. Group by task (task boundary = user message)
|
||||
3. Find recurring sequences:
|
||||
- Use n-gram analysis (n=2 to 5)
|
||||
- Count frequency of each n-gram
|
||||
- Filter to sequences with frequency >= 3
|
||||
4. For each recurring sequence:
|
||||
- Calculate confidence based on frequency and consistency
|
||||
- Extract as tool chain pattern
|
||||
```
|
||||
|
||||
**N-gram analysis**:
|
||||
|
||||
```javascript
|
||||
function extractToolChains(agentMessages) {
|
||||
const sequences = [];
|
||||
|
||||
for (const message of agentMessages) {
|
||||
const tools = extractToolCalls(message); // ['Read', 'Edit', 'Bash']
|
||||
sequences.push(tools);
|
||||
}
|
||||
|
||||
// Find recurring n-grams
|
||||
const ngrams = {};
|
||||
for (const seq of sequences) {
|
||||
for (let n = 2; n <= Math.min(5, seq.length); n++) {
|
||||
for (let i = 0; i <= seq.length - n; i++) {
|
||||
const gram = seq.slice(i, i + n).join(' → ');
|
||||
ngrams[gram] = (ngrams[gram] || 0) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter to frequent patterns
|
||||
const chains = Object.entries(ngrams)
|
||||
.filter(([gram, count]) => count >= 3)
|
||||
.map(([gram, count]) => ({
|
||||
chain: gram,
|
||||
frequency: count,
|
||||
confidence: count >= 5 ? 'high' : count >= 3 ? 'medium' : 'low'
|
||||
}));
|
||||
|
||||
return chains;
|
||||
}
|
||||
```
|
||||
|
||||
### Request Signals
|
||||
|
||||
#### Prohibition Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Absolute prohibitions
|
||||
\b(never|don't|do\s+not)\s+
|
||||
\bavoid\s+(using|doing)\s+
|
||||
|
||||
# Explicit constraints
|
||||
\bno\s+\w+\b
|
||||
\bwithout\s+\w+\b
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. "Never" = high confidence prohibition
|
||||
2. "Don't" + imperative = high confidence
|
||||
3. "Avoid" = medium confidence (softer prohibition)
|
||||
4. "No X" = context-dependent (check if X is an action or noun)
|
||||
|
||||
**Context checks**:
|
||||
|
||||
```
|
||||
If prohibition suspected:
|
||||
- Extract prohibited action/item
|
||||
- Check for exceptions: "don't X unless Y"
|
||||
- If exception: conditional signal, not absolute prohibition
|
||||
- If no exception: prohibition (confidence based on strength of negation)
|
||||
```
|
||||
|
||||
#### Requirement Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Modal verbs
|
||||
\b(must|should|need\s+to|have\s+to|always)\s+
|
||||
|
||||
# Imperatives with emphasis
|
||||
\bmake\s+sure\s+(to\s+)?
|
||||
\bensure\s+(that\s+)?
|
||||
\bremember\s+to\s+
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. "Must" / "Always" = high confidence requirement
|
||||
2. "Should" = medium confidence requirement
|
||||
3. "Make sure" = medium confidence requirement
|
||||
4. Bare imperative ("Run tests") = context-dependent
|
||||
|
||||
**Strength scoring**:
|
||||
|
||||
```javascript
|
||||
function classifyRequirement(message) {
|
||||
if (/\b(must|always|required)\b/i.test(message)) {
|
||||
return { strength: 'strong', confidence: 'high' };
|
||||
}
|
||||
if (/\b(should|need\s+to|make\s+sure)\b/i.test(message)) {
|
||||
return { strength: 'moderate', confidence: 'medium' };
|
||||
}
|
||||
if (/\b(could|might\s+want\s+to|consider)\b/i.test(message)) {
|
||||
return { strength: 'weak', confidence: 'low' };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
```
|
||||
|
||||
#### Preference Detection
|
||||
|
||||
**Patterns**:
|
||||
|
||||
```regex
|
||||
# Explicit preference
|
||||
\bI\s+prefer\s+
|
||||
\bI'd\s+rather\s+
|
||||
\bI\s+like\s+\w+\s+(better|more)\b
|
||||
|
||||
# Comparative language
|
||||
\b(better|cleaner|easier|simpler)\s+to\s+
|
||||
\bX\s+over\s+Y\b
|
||||
```
|
||||
|
||||
**Heuristic rules**:
|
||||
|
||||
1. "I prefer X" = high confidence preference
|
||||
2. "X is better" = medium confidence (could be objective claim)
|
||||
3. "I like X" = low confidence (weak preference)
|
||||
4. Check for comparison: "X over Y" or "X not Y" strengthens signal
|
||||
|
||||
**Subjectivity detection**:
|
||||
|
||||
```javascript
|
||||
function isSubjective(statement) {
|
||||
// Check for first-person markers
|
||||
const firstPerson = /\b(I|my|me)\b/i.test(statement);
|
||||
|
||||
// Check for subjective language
|
||||
const subjective = /\b(prefer|like|rather|think|believe|feel)\b/i.test(statement);
|
||||
|
||||
// Check for evaluative language
|
||||
const evaluative = /\b(better|worse|best|worst|cleaner|messier)\b/i.test(statement);
|
||||
|
||||
return firstPerson || subjective || evaluative;
|
||||
}
|
||||
```
|
||||
|
||||
## Message Boundary Detection
|
||||
|
||||
Identify where user messages begin and end, separating from agent messages and tool outputs.
|
||||
|
||||
### Actor Classification
|
||||
|
||||
```javascript
|
||||
function classifyActor(message) {
|
||||
// Check for role markers
|
||||
if (message.role === 'user') return 'user';
|
||||
if (message.role === 'assistant') return 'agent';
|
||||
|
||||
// Fallback to content analysis
|
||||
if (/<function_calls>/i.test(message.content)) return 'agent';
|
||||
if (/<function_results>/i.test(message.content)) return 'tool';
|
||||
|
||||
// Default to user for ambiguous cases
|
||||
return 'user';
|
||||
}
|
||||
```
|
||||
|
||||
### Message Filtering
|
||||
|
||||
```javascript
|
||||
function filterMessages(conversation, options = {}) {
|
||||
const {
|
||||
actors = ['user', 'agent'],
|
||||
excludeToolOutput = true,
|
||||
excludeCodeBlocks = false,
|
||||
minLength = 0,
|
||||
} = options;
|
||||
|
||||
return conversation
|
||||
.filter(msg => actors.includes(classifyActor(msg)))
|
||||
.filter(msg => !excludeToolOutput || !msg.content.includes('<function_results>'))
|
||||
.filter(msg => !excludeCodeBlocks || !msg.content.includes('```'))
|
||||
.filter(msg => msg.content.length >= minLength);
|
||||
}
|
||||
```
|
||||
|
||||
## Multi-Turn Pattern Recognition
|
||||
|
||||
Detect patterns that span multiple messages.
|
||||
|
||||
### Escalation Detection
|
||||
|
||||
```javascript
|
||||
function detectEscalation(messages) {
|
||||
// Group messages by topic
|
||||
const topics = clusterByTopic(messages);
|
||||
|
||||
for (const topic of topics) {
|
||||
// Check if frustration increases over time
|
||||
const frustrationScores = topic.messages.map(msg => {
|
||||
const signals = extractSignals(msg);
|
||||
return signals.filter(s => s.type === 'frustration').length;
|
||||
});
|
||||
|
||||
// Check for monotonic increase
|
||||
let isEscalating = true;
|
||||
for (let i = 1; i < frustrationScores.length; i++) {
|
||||
if (frustrationScores[i] <= frustrationScores[i - 1]) {
|
||||
isEscalating = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEscalating && frustrationScores.length >= 2) {
|
||||
return {
|
||||
pattern: 'escalation',
|
||||
topic: topic.name,
|
||||
messages: topic.messages,
|
||||
confidence: frustrationScores.length >= 3 ? 'high' : 'medium'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
```
|
||||
|
||||
### Topic Clustering
|
||||
|
||||
```javascript
|
||||
function clusterByTopic(messages) {
|
||||
// Simple keyword-based clustering
|
||||
const clusters = [];
|
||||
|
||||
for (const msg of messages) {
|
||||
const keywords = extractKeywords(msg);
|
||||
|
||||
// Find existing cluster with matching keywords
|
||||
let matched = false;
|
||||
for (const cluster of clusters) {
|
||||
const overlap = keywords.filter(k => cluster.keywords.includes(k));
|
||||
if (overlap.length / keywords.length > 0.3) {
|
||||
cluster.messages.push(msg);
|
||||
cluster.keywords = [...new Set([...cluster.keywords, ...keywords])];
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new cluster if no match
|
||||
if (!matched) {
|
||||
clusters.push({
|
||||
name: keywords[0] || 'unnamed',
|
||||
keywords,
|
||||
messages: [msg]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return clusters;
|
||||
}
|
||||
|
||||
function extractKeywords(message) {
|
||||
// Remove stop words and extract nouns/verbs
|
||||
const stopWords = new Set(['the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for']);
|
||||
|
||||
const words = message.content
|
||||
.toLowerCase()
|
||||
.replace(/[^\w\s]/g, '')
|
||||
.split(/\s+/)
|
||||
.filter(w => w.length > 3 && !stopWords.has(w));
|
||||
|
||||
// Return top 5 most frequent words
|
||||
const freq = {};
|
||||
for (const word of words) {
|
||||
freq[word] = (freq[word] || 0) + 1;
|
||||
}
|
||||
|
||||
return Object.entries(freq)
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.slice(0, 5)
|
||||
.map(([word]) => word);
|
||||
}
|
||||
```
|
||||
|
||||
## Context Analysis Methods
|
||||
|
||||
### Recency Weighting
|
||||
|
||||
More recent signals should carry more weight than older ones.
|
||||
|
||||
```javascript
|
||||
function applyRecencyWeight(signals, halfLifeDays = 7) {
|
||||
const now = Date.now();
|
||||
const halfLifeMs = halfLifeDays * 24 * 60 * 60 * 1000;
|
||||
|
||||
return signals.map(signal => {
|
||||
const age = now - signal.timestamp;
|
||||
const weight = Math.pow(0.5, age / halfLifeMs);
|
||||
|
||||
return {
|
||||
...signal,
|
||||
weight,
|
||||
weightedConfidence: signal.confidence * weight
|
||||
};
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Contradiction Resolution
|
||||
|
||||
When signals conflict, resolve using recency and confidence.
|
||||
|
||||
```javascript
|
||||
function resolveContradictions(signals) {
|
||||
// Group by topic
|
||||
const groups = groupByTopic(signals);
|
||||
|
||||
for (const group of groups) {
|
||||
// Sort by timestamp (newest first)
|
||||
group.signals.sort((a, b) => b.timestamp - a.timestamp);
|
||||
|
||||
// Check for contradictions
|
||||
const contradictions = findContradictions(group.signals);
|
||||
|
||||
for (const [newer, older] of contradictions) {
|
||||
if (newer.confidence >= older.confidence) {
|
||||
// Mark older signal as superseded
|
||||
older.superseded = true;
|
||||
older.supersededBy = newer.message_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out superseded signals
|
||||
return signals.filter(s => !s.superseded);
|
||||
}
|
||||
|
||||
function findContradictions(signals) {
|
||||
const pairs = [];
|
||||
|
||||
for (let i = 0; i < signals.length; i++) {
|
||||
for (let j = i + 1; j < signals.length; j++) {
|
||||
if (areContradictory(signals[i], signals[j])) {
|
||||
pairs.push([signals[i], signals[j]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
|
||||
function areContradictory(signal1, signal2) {
|
||||
// Example: "Use X" vs. "Don't use X"
|
||||
if (signal1.type === 'request' && signal2.type === 'request') {
|
||||
// Extract actions
|
||||
const action1 = signal1.quote.match(/\b(use|do|make|add)\s+(\w+)/i);
|
||||
const action2 = signal2.quote.match(/\b(don't|never|avoid)\s+(use|do|make|add)?\s*(\w+)/i);
|
||||
|
||||
if (action1 && action2 && action1[2] === action2[3]) {
|
||||
return true; // Contradiction: "use X" vs. "don't use X"
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
## Performance Optimization
|
||||
|
||||
### Incremental Analysis
|
||||
|
||||
For long conversations, analyze incrementally rather than re-analyzing entire history.
|
||||
|
||||
```javascript
|
||||
class IncrementalAnalyzer {
|
||||
constructor() {
|
||||
this.lastAnalyzedIndex = 0;
|
||||
this.signals = [];
|
||||
this.patterns = [];
|
||||
}
|
||||
|
||||
analyze(messages) {
|
||||
// Only analyze new messages
|
||||
const newMessages = messages.slice(this.lastAnalyzedIndex);
|
||||
|
||||
// Extract signals from new messages
|
||||
const newSignals = newMessages.flatMap(msg => extractSignals(msg));
|
||||
this.signals.push(...newSignals);
|
||||
|
||||
// Update patterns with new signals
|
||||
this.patterns = detectPatterns(this.signals);
|
||||
|
||||
// Update index
|
||||
this.lastAnalyzedIndex = messages.length;
|
||||
|
||||
return {
|
||||
signals: this.signals,
|
||||
patterns: this.patterns
|
||||
};
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.lastAnalyzedIndex = 0;
|
||||
this.signals = [];
|
||||
this.patterns = [];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Caching
|
||||
|
||||
Cache expensive operations like topic clustering and keyword extraction.
|
||||
|
||||
```javascript
|
||||
class AnalysisCache {
|
||||
constructor(ttlMs = 5 * 60 * 1000) { // 5 minute TTL
|
||||
this.cache = new Map();
|
||||
this.ttl = ttlMs;
|
||||
}
|
||||
|
||||
get(key) {
|
||||
const entry = this.cache.get(key);
|
||||
if (!entry) return null;
|
||||
|
||||
if (Date.now() - entry.timestamp > this.ttl) {
|
||||
this.cache.delete(key);
|
||||
return null;
|
||||
}
|
||||
|
||||
return entry.value;
|
||||
}
|
||||
|
||||
set(key, value) {
|
||||
this.cache.set(key, {
|
||||
value,
|
||||
timestamp: Date.now()
|
||||
});
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Usage
|
||||
const cache = new AnalysisCache();
|
||||
|
||||
function extractSignalsWithCache(message) {
|
||||
const key = `signals:${message.id}`;
|
||||
const cached = cache.get(key);
|
||||
|
||||
if (cached) return cached;
|
||||
|
||||
const signals = extractSignals(message);
|
||||
cache.set(key, signals);
|
||||
|
||||
return signals;
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Graceful Degradation
|
||||
|
||||
If signal extraction fails for a message, continue with remaining messages.
|
||||
|
||||
```javascript
|
||||
function extractSignalsSafe(messages) {
|
||||
const results = {
|
||||
signals: [],
|
||||
errors: []
|
||||
};
|
||||
|
||||
for (const msg of messages) {
|
||||
try {
|
||||
const signals = extractSignals(msg);
|
||||
results.signals.push(...signals);
|
||||
} catch (error) {
|
||||
results.errors.push({
|
||||
message_id: msg.id,
|
||||
error: error.message
|
||||
});
|
||||
// Continue with next message
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
```
|
||||
|
||||
### Validation
|
||||
|
||||
Validate extracted signals before adding to results.
|
||||
|
||||
```javascript
|
||||
function validateSignal(signal) {
|
||||
const required = ['type', 'subtype', 'message_id', 'quote', 'confidence'];
|
||||
|
||||
for (const field of required) {
|
||||
if (!(field in signal)) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
}
|
||||
}
|
||||
|
||||
const validTypes = ['success', 'frustration', 'workflow', 'request'];
|
||||
if (!validTypes.includes(signal.type)) {
|
||||
throw new Error(`Invalid signal type: ${signal.type}`);
|
||||
}
|
||||
|
||||
if (signal.confidence < 0 || signal.confidence > 1) {
|
||||
throw new Error(`Confidence must be 0-1, got: ${signal.confidence}`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
# Signal Patterns Reference
|
||||
|
||||
Extended taxonomy with edge cases, disambiguation guidance, and confidence scoring rubric.
|
||||
|
||||
## Success Signals
|
||||
|
||||
### Explicit Praise
|
||||
|
||||
**Core indicators**: Positive adjectives, exclamation marks, superlatives.
|
||||
|
||||
**Examples**:
|
||||
- "Perfect!"
|
||||
- "Exactly what I needed"
|
||||
- "This is great work"
|
||||
- "Love it"
|
||||
- "Well done"
|
||||
|
||||
**Edge cases**:
|
||||
- "Good enough" → Low confidence (lukewarm, not enthusiastic)
|
||||
- "That works" → Low confidence (neutral acceptance, not praise)
|
||||
- "Thanks" → Context-dependent (could be courtesy, not satisfaction)
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Superlatives ("perfect", "excellent"), multiple exclamations, enthusiastic tone
|
||||
- **Medium**: Positive adjectives ("good", "nice") with neutral tone
|
||||
- **Low**: Minimal positive language, could be polite rather than satisfied
|
||||
|
||||
### Continuation
|
||||
|
||||
**Core indicators**: Building on previous work, extending scope, applying pattern elsewhere.
|
||||
|
||||
**Examples**:
|
||||
- "Now do the same for the login page"
|
||||
- "Apply this pattern to all API routes"
|
||||
- "Great, next let's handle the error cases"
|
||||
|
||||
**Edge cases**:
|
||||
- "Now try X instead" → Frustration (correction) if contradicts prior work
|
||||
- "Also do Y" → Continuation only if X succeeded; check for corrections first
|
||||
- "Next, fix the bug in Z" → Context switch, not continuation
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit reference to prior success + request to extend
|
||||
- **Medium**: Implied satisfaction + new related task
|
||||
- **Low**: Sequential tasks without confirmation of prior success
|
||||
|
||||
### Adoption
|
||||
|
||||
**Core indicators**: User implements agent's suggestion without modification or pushback.
|
||||
|
||||
**Examples**:
|
||||
- Agent: "Use TanStack Router" → User: *next message shows TanStack Router implementation*
|
||||
- Agent: "Refactor to use async/await" → User: "Done, looks cleaner"
|
||||
- Agent suggests pattern → User's code follows pattern exactly
|
||||
|
||||
**Edge cases**:
|
||||
- User modifies suggestion before implementing → Medium confidence (partial adoption)
|
||||
- User implements after asking clarifying questions → Still adoption (high confidence)
|
||||
- User implements weeks later → Weak adoption signal (confounded by time)
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Immediate implementation with no modifications
|
||||
- **Medium**: Implementation after clarification or with minor adjustments
|
||||
- **Low**: Implementation significantly delayed or heavily modified
|
||||
|
||||
### Completion Acceptance
|
||||
|
||||
**Core indicators**: Approval language followed by action (merge, ship, close ticket).
|
||||
|
||||
**Examples**:
|
||||
- "Looks good, merge it"
|
||||
- "Ship it"
|
||||
- "Perfect, closing this issue"
|
||||
- "LGTM" (Looks Good To Me)
|
||||
|
||||
**Edge cases**:
|
||||
- "Looks good, but..." → Conditional acceptance, check for follow-up corrections
|
||||
- "Merge" without review → Context-dependent (could be trust or urgency, not satisfaction)
|
||||
- "Ship it" with sarcasm → Rare but check surrounding context for frustration
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit approval + action directive
|
||||
- **Medium**: Approval without action or action without explicit approval
|
||||
- **Low**: Ambiguous approval ("fine", "okay") that could indicate resignation
|
||||
|
||||
## Frustration Signals
|
||||
|
||||
### Correction
|
||||
|
||||
**Core indicators**: Negation words, contradiction of agent output, explicit redirection.
|
||||
|
||||
**Examples**:
|
||||
- "No, I meant X not Y"
|
||||
- "That's wrong, do Z instead"
|
||||
- "Actually, use A instead of B"
|
||||
|
||||
**Edge cases**:
|
||||
- "Small correction: use X" → Frustration (low confidence) if agent should have known
|
||||
- "Let's adjust to X" → Not frustration if iterating on shared work
|
||||
- "Change X to Y" → Context-dependent (correction vs. evolution)
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit negation ("no", "wrong", "don't") + correction
|
||||
- **Medium**: Implicit correction ("actually", "instead") without harsh language
|
||||
- **Low**: Neutral adjustment language that could be iteration not correction
|
||||
|
||||
### Reversion
|
||||
|
||||
**Core indicators**: Request to undo agent's changes, return to previous state.
|
||||
|
||||
**Examples**:
|
||||
- "Revert that change"
|
||||
- "Go back to the original version"
|
||||
- "Undo what you just did"
|
||||
- User manually reverts agent's commit
|
||||
|
||||
**Edge cases**:
|
||||
- "Let's try the original approach" → Could be exploration, not frustration
|
||||
- Revert after testing both options → Scientific method, not frustration
|
||||
- Partial revert → Medium confidence (some parts worked, some didn't)
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit revert request with no justification (implies failure)
|
||||
- **Medium**: Revert with explanation that agent's approach had issues
|
||||
- **Low**: Revert as part of A/B testing or exploration
|
||||
|
||||
### Repetition
|
||||
|
||||
**Core indicators**: Same request issued 2+ times with escalating specificity or frustration.
|
||||
|
||||
**Examples**:
|
||||
- Message 1: "Use Bun not npm"
|
||||
- Message 2: "Again, use Bun"
|
||||
- Message 3: "I already told you to use Bun!"
|
||||
|
||||
**Edge cases**:
|
||||
- Repetition after context switch → May not be frustration, could be reminder
|
||||
- Repetition with new information → Evolution, not frustration
|
||||
- Repetition across different tasks → Preference signal, not frustration
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: 3+ repetitions with escalating tone or "again"/"already told you"
|
||||
- **Medium**: 2 repetitions with no new context
|
||||
- **Low**: 2 similar requests in different contexts (could be unrelated)
|
||||
|
||||
### Explicit Frustration
|
||||
|
||||
**Core indicators**: Direct expression of dissatisfaction, questioning agent's behavior.
|
||||
|
||||
**Examples**:
|
||||
- "This isn't working"
|
||||
- "Why did you do X when I said Y?"
|
||||
- "I already told you not to..."
|
||||
- "This is frustrating"
|
||||
|
||||
**Edge cases**:
|
||||
- "Hmm, that's odd" → Confusion, not necessarily frustration
|
||||
- "Why X?" → Curiosity if neutral tone; frustration if accusatory
|
||||
- "Not quite" → Gentle correction, low frustration
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit frustration words ("frustrating", "annoying") or accusatory questions
|
||||
- **Medium**: Implied dissatisfaction ("not working", "this is wrong")
|
||||
- **Low**: Neutral problem statements without emotional language
|
||||
|
||||
## Workflow Signals
|
||||
|
||||
### Sequence Markers
|
||||
|
||||
**Core indicators**: Ordinal language, numbered lists, temporal connectives.
|
||||
|
||||
**Examples**:
|
||||
- "First, do X. Then Y. Finally Z."
|
||||
- "Step 1: A, Step 2: B, Step 3: C"
|
||||
- "Before we start, let's..."
|
||||
|
||||
**Edge cases**:
|
||||
- Single "first" without "second" → Low confidence (could be emphasis, not sequence)
|
||||
- "Then" without "first" → Continuation, not new sequence
|
||||
- Numbered list describing features (not steps) → Not workflow signal
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Multiple ordinal markers (first, second, third) or numbered steps
|
||||
- **Medium**: Single sequence marker with clear temporal relationship
|
||||
- **Low**: Ambiguous temporal language ("before", "after") without clear sequence
|
||||
|
||||
### Stage Transitions
|
||||
|
||||
**Core indicators**: Reference to completion + new direction, explicit context shift.
|
||||
|
||||
**Examples**:
|
||||
- "Now that X is done, let's work on Y"
|
||||
- "Moving on to the API layer"
|
||||
- "With that complete, next is..."
|
||||
|
||||
**Edge cases**:
|
||||
- "Let's do Y" without completion reference → Context switch, not stage transition
|
||||
- "After X, do Y" (pre-planning) → Sequence marker, not transition
|
||||
- "Y is next" → Future reference, not active transition
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit completion reference + new task
|
||||
- **Medium**: Implied completion + new direction
|
||||
- **Low**: New task without completion signal (could be interruption)
|
||||
|
||||
### Tool Chains
|
||||
|
||||
**Core indicators**: Consistent sequence of tool usage across multiple tasks.
|
||||
|
||||
**Examples**:
|
||||
- Pattern: Read → Edit → Bash (test) appears 5+ times
|
||||
- Pattern: Glob → Grep → Read appears 3+ times for search tasks
|
||||
- Pattern: Write → Bash (validate) appears 4+ times
|
||||
|
||||
**Edge cases**:
|
||||
- Same tools in different order → Not a chain, separate usage
|
||||
- Tool chain appears once → Not a pattern yet
|
||||
- Tool chain broken by user interruption → Still valid if resumes afterward
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: 5+ occurrences of same tool sequence
|
||||
- **Medium**: 3-4 occurrences with occasional variation
|
||||
- **Low**: 2 occurrences or significant variation in sequence
|
||||
|
||||
### Context Switches
|
||||
|
||||
**Core indicators**: Abrupt topic change, new file focus, no transition language.
|
||||
|
||||
**Examples**:
|
||||
- Working on auth.ts → Suddenly "Fix the database schema"
|
||||
- Discussing React components → "Now debug the API"
|
||||
- Mid-task: "Actually, let's work on something else"
|
||||
|
||||
**Edge cases**:
|
||||
- Switch after completing task → Stage transition, not context switch
|
||||
- Switch with explanation → Intentional pivot, still a switch but lower friction
|
||||
- Return to previous context → Resumption, not new switch
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Abrupt change with no transition, different domain
|
||||
- **Medium**: Change with minimal transition or related domain
|
||||
- **Low**: Change with explanation or natural task completion
|
||||
|
||||
## Request Signals
|
||||
|
||||
### Prohibition
|
||||
|
||||
**Core indicators**: Negative imperatives, explicit constraints, "don't" statements.
|
||||
|
||||
**Examples**:
|
||||
- "Don't use any types"
|
||||
- "Never use npm, always use Bun"
|
||||
- "Avoid using classes"
|
||||
|
||||
**Edge cases**:
|
||||
- "I wouldn't use X" → Preference, not prohibition (softer language)
|
||||
- "Don't do X unless Y" → Conditional prohibition
|
||||
- "Try not to X" → Soft prohibition (low confidence)
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Absolute negatives ("never", "don't", "no") with no conditions
|
||||
- **Medium**: Soft negatives ("avoid", "try not to") or conditional prohibitions
|
||||
- **Low**: Implicit discouragement without explicit prohibition
|
||||
|
||||
### Requirement
|
||||
|
||||
**Core indicators**: Absolute language, modal verbs (must, should, always), imperatives.
|
||||
|
||||
**Examples**:
|
||||
- "Always run tests before committing"
|
||||
- "You must validate input"
|
||||
- "Make sure to check for errors"
|
||||
|
||||
**Edge cases**:
|
||||
- "It's good to X" → Preference, not requirement
|
||||
- "Should probably X" → Weak requirement (medium confidence)
|
||||
- "Try to X" → Suggestion, not requirement
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Absolute modal verbs ("must", "always") or strong imperatives
|
||||
- **Medium**: Soft modal verbs ("should") or qualified requirements
|
||||
- **Low**: Suggestions ("could", "might want to") without strong language
|
||||
|
||||
### Preference
|
||||
|
||||
**Core indicators**: Comparative language, subjective statements, "prefer" / "better" / "rather".
|
||||
|
||||
**Examples**:
|
||||
- "I prefer TypeScript over JavaScript"
|
||||
- "It's better to use async/await"
|
||||
- "I'd rather use functional components"
|
||||
|
||||
**Edge cases**:
|
||||
- "I like X" → Weak preference (low confidence)
|
||||
- "X is better" (stated as fact) → Could be requirement depending on tone
|
||||
- "Prefer X, but Y works too" → Flexible preference (medium confidence)
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit preference language ("prefer", "I'd rather") with comparison
|
||||
- **Medium**: Implied preference through evaluation ("better", "cleaner")
|
||||
- **Low**: Weak positive statements without comparison
|
||||
|
||||
### Conditional
|
||||
|
||||
**Core indicators**: Logical connectives (if/then, when, unless), situational rules.
|
||||
|
||||
**Examples**:
|
||||
- "If X then Y"
|
||||
- "When working on auth, always use Z"
|
||||
- "Unless A, do B"
|
||||
|
||||
**Edge cases**:
|
||||
- "Maybe if X" → Uncertain conditional (low confidence)
|
||||
- "X or Y depending on Z" → Multiple conditionals, complex rule
|
||||
- "If X" without "then" → Incomplete conditional, infer consequence from context
|
||||
|
||||
**Confidence criteria**:
|
||||
- **High**: Explicit if/then structure with clear condition and action
|
||||
- **Medium**: Implied conditional (when, unless) or incomplete structure
|
||||
- **Low**: Vague conditional ("depending on", "maybe if")
|
||||
|
||||
## Disambiguation Guidance
|
||||
|
||||
### Success vs. Frustration
|
||||
|
||||
**Ambiguous case**: "That works"
|
||||
|
||||
- **Success** if: No prior corrections, agent's first attempt, user moves on
|
||||
- **Frustration** if: After multiple attempts, lukewarm tone, user makes adjustments
|
||||
|
||||
**Rule**: Check for prior corrections. If 0-1, success. If 2+, frustration.
|
||||
|
||||
### Continuation vs. Correction
|
||||
|
||||
**Ambiguous case**: "Now do X for Y too"
|
||||
|
||||
- **Continuation** if: X succeeded for original target, Y is similar target
|
||||
- **Correction** if: X failed for original target, Y is different approach
|
||||
|
||||
**Rule**: Verify success of X before classifying as continuation.
|
||||
|
||||
### Request vs. Workflow
|
||||
|
||||
**Ambiguous case**: "Always run tests before committing"
|
||||
|
||||
- **Request (requirement)** if: User establishing new rule
|
||||
- **Workflow (sequence)** if: User describing existing process
|
||||
|
||||
**Rule**: Check if user is prescribing (request) or describing (workflow). Use tense as clue: imperative = request, present tense = workflow.
|
||||
|
||||
### Preference vs. Requirement
|
||||
|
||||
**Ambiguous case**: "Use TypeScript"
|
||||
|
||||
- **Preference** if: Soft language, alternatives mentioned, presented as opinion
|
||||
- **Requirement** if: Absolute language, no alternatives, presented as rule
|
||||
|
||||
**Rule**: Look for qualifiers. "I prefer X" = preference. "Use X" = requirement. "Always use X" = strong requirement.
|
||||
|
||||
## Confidence Scoring Rubric
|
||||
|
||||
### High Confidence (0.8 - 1.0)
|
||||
|
||||
- Explicit signal keywords match taxonomy exactly
|
||||
- No ambiguity in language or intent
|
||||
- Context strongly supports classification
|
||||
- Multiple supporting clues (tone, punctuation, surrounding messages)
|
||||
|
||||
**Example**: "Don't use npm, always use Bun" → Prohibition (high confidence)
|
||||
|
||||
### Medium Confidence (0.5 - 0.79)
|
||||
|
||||
- Implicit signal requiring some interpretation
|
||||
- Context provides partial support
|
||||
- Minor ambiguity but best classification is clear
|
||||
- Single supporting clue or mixed signals
|
||||
|
||||
**Example**: "Bun is better here" → Preference (medium confidence)
|
||||
|
||||
### Low Confidence (0.2 - 0.49)
|
||||
|
||||
- Ambiguous language with multiple possible interpretations
|
||||
- Weak or contradictory context
|
||||
- Signal requires significant inference
|
||||
- Borderline between two signal types
|
||||
|
||||
**Example**: "That's fine" → Success? Frustration? (low confidence)
|
||||
|
||||
### No Signal (< 0.2)
|
||||
|
||||
- Neutral language with no clear signal
|
||||
- Insufficient context to classify
|
||||
- Pure information exchange with no behavioral indicator
|
||||
|
||||
**Example**: "The file is at /path/to/file" → No signal
|
||||
|
||||
## Signal Combinations
|
||||
|
||||
Certain signal combinations indicate specific patterns:
|
||||
|
||||
### Success → Continuation
|
||||
|
||||
Pattern: **Positive Reinforcement Loop**
|
||||
|
||||
User satisfied with approach and wants to extend it.
|
||||
|
||||
```
|
||||
Message 1: "Perfect! This works great" (success: explicit praise)
|
||||
Message 2: "Now apply this to all the other routes" (success: continuation)
|
||||
```
|
||||
|
||||
**Recommendation**: Internalize the successful approach as a pattern to reuse.
|
||||
|
||||
### Frustration (repetition) → Success
|
||||
|
||||
Pattern: **Learning Curve Overcome**
|
||||
|
||||
Agent initially misunderstood but eventually delivered correctly.
|
||||
|
||||
```
|
||||
Message 1: "Use Bun not npm" (frustration: correction)
|
||||
Message 2: "Again, Bun not npm" (frustration: repetition)
|
||||
Message 3: "Perfect, that's the right package manager" (success: praise)
|
||||
```
|
||||
|
||||
**Recommendation**: Add the learned requirement to memory to avoid future repetition.
|
||||
|
||||
### Request (prohibition) + Frustration (repetition)
|
||||
|
||||
Pattern: **Persistent Violation**
|
||||
|
||||
Agent repeatedly violates an explicit constraint.
|
||||
|
||||
```
|
||||
Message 1: "Don't use any types" (request: prohibition)
|
||||
Message 3: "I said no any types" (frustration: repetition + request)
|
||||
Message 5: "Again, avoid any types" (frustration: repetition + request)
|
||||
```
|
||||
|
||||
**Recommendation**: Escalate to memory update or configuration change. This is a critical user requirement being violated.
|
||||
|
||||
### Workflow (tool chain) + Success (adoption)
|
||||
|
||||
Pattern: **Workflow Optimization**
|
||||
|
||||
User established efficient tool sequence and agent adopted it.
|
||||
|
||||
```
|
||||
Message 1: "Read, then Edit, then run tests" (workflow: sequence)
|
||||
Message 3: *agent follows sequence* (workflow: tool chain)
|
||||
Message 5: "Great, you've got the workflow down" (success: praise)
|
||||
```
|
||||
|
||||
**Recommendation**: Codify tool chain as a standard workflow template.
|
||||
|
||||
### Context Switch + Frustration (explicit)
|
||||
|
||||
Pattern: **Blocked Progress**
|
||||
|
||||
User abandons current task due to persistent issues.
|
||||
|
||||
```
|
||||
Message 1: "This isn't working" (frustration: explicit)
|
||||
Message 2: "Let's work on something else instead" (workflow: context switch)
|
||||
```
|
||||
|
||||
**Recommendation**: Mark the abandoned task for later review. Likely indicates a blocker or knowledge gap.
|
||||
|
||||
## Temporal Patterns
|
||||
|
||||
### Escalation Pattern
|
||||
|
||||
Signal intensity increases over time.
|
||||
|
||||
```
|
||||
T1: "Use Bun" (request: preference)
|
||||
T2: "Please use Bun, not npm" (request: requirement)
|
||||
T3: "I already told you to use Bun!" (frustration: repetition + explicit)
|
||||
```
|
||||
|
||||
**Detection**: Same topic, increasing frustration or stronger modal verbs.
|
||||
|
||||
**Recommendation**: High-priority memory update. User is emphasizing this requirement.
|
||||
|
||||
### De-escalation Pattern
|
||||
|
||||
Frustration decreases as issue resolves.
|
||||
|
||||
```
|
||||
T1: "This is broken" (frustration: explicit)
|
||||
T2: "Getting closer" (neutral)
|
||||
T3: "Perfect!" (success: praise)
|
||||
```
|
||||
|
||||
**Detection**: Same topic, decreasing frustration and increasing success signals.
|
||||
|
||||
**Recommendation**: Identify what changed between T2 and T3. This is the successful approach.
|
||||
|
||||
### Cyclical Pattern
|
||||
|
||||
Same issue recurs periodically.
|
||||
|
||||
```
|
||||
Day 1: "Use TypeScript" (request)
|
||||
Day 5: "Remember to use TypeScript" (frustration: repetition)
|
||||
Day 10: "Again, TypeScript not JavaScript" (frustration: repetition)
|
||||
```
|
||||
|
||||
**Detection**: Same request/correction across multiple sessions with time gaps.
|
||||
|
||||
**Recommendation**: Critical memory failure. Agent is not retaining this requirement across sessions.
|
||||
Reference in New Issue
Block a user