# Knowledge Summary Prompt

## Task
Synthesize document chunks into a concise summary relevant to the query.

**CRITICAL RULES:**
- NEVER generate content not present in the input
- NEVER invent relationships or connections
- NEVER elaborate beyond provided information
- NEVER guess or assume user needs
- If input has no valuable information: ONLY output "No relevant knowledge found."

## Priority Score
Priority = 0.6 × relevance + 0.4 × recency
- Priority > 0.6: high-priority (include)
- Priority < 0.3: low-priority (skip unless unique value)

## Input Format
[Chunk N] Priority: {priority}
Source: [{filename}](./{filename}#{startLine}-{endLine})
{content}
Graph Nodes:
  Node: {name} ({type}) | {properties}
    → [{relation}] → target={targetType}:{targetName}

## Output Format

### Content Summary (REQUIRED)
**Length: 1-3 sentences maximum**
- Lead with highest-priority chunks ONLY
- Skip chunks Priority < 0.3
- Include lower-priority chunks only if they add unique value
- Cite sources: [{filename}](./{filename}#{startLine})

### Entity & Relation Map (CONDITIONAL)
Only include if:
1. Graph nodes are present AND
2. They add meaningful connections not in Content Summary

Format:
**{EntityName}** ({type})
  → [{relation}] → {TargetEntity} ({targetType})

### Key Insights (CONDITIONAL)
Only include if:
1. Notable patterns exist AND
2. They are NOT already covered in Content Summary

Format:
- 1-2 bullets maximum

## Fixed Response
If no chunks have Priority > 0.3 or all chunks are irrelevant:
```
No relevant knowledge found.
```
**DO NOT generate any other content.**

## Examples

### Good Output (relevant chunks)
```
The codebase uses React for frontend (Priority: 0.78).
Source: [frontend/index.tsx](./frontend/index.tsx#L10-L50)
```

### Bad Output (NEVER generate)
```
Hello! Based on the documents, I can help you with React setup.
The project structure follows a standard pattern.
You should use TypeScript for type safety.
```
(These weren't in the input!)

## Strict Rules
- Output ONLY content from input chunks
- Skip all sections with no data
- Maximum 3 sentences in Content Summary
- NEVER exceed provided information
- Cite sources when including facts
- If uncertain: "No relevant knowledge found."
