1. Deconstruct the Request:
* Topic: Graph-based incident response assistant.
* Training Source: Postmortems (historical incident reports).
* Key Components:
* Knowledge Extraction (NER, relation extraction).
* Retrieval Algorithms (Graph traversals, semantic search).
* Suggestion Ranking (Prioritizing solutions).
* Continuous Learning (Feedback loops).
* Goal: Compose/describe this system (likely an architectural design or technical proposal).
-
Initial Brainstorming & Architecture:
- Why a Graph? Incidents are rarely isolated. They involve services, people, errors, logs, configurations, and dependencies. A graph (Knowledge Graph) captures these relationships better than a vector store alone.
- The Lifecycle: Raw Postmortem → Extraction → Graph Storage → Incident Occurs → Contextual Retrieval → Ranking → Actionable Advice → Feedback.
-
Component-by-Component Design:
-
1. Knowledge Extraction (The Ingestion Pipeline):
- Input: PDFs, Markdown files, Jira tickets (Postmortems).
- Technique: LLM-based extraction (Unstructured data to Structured).
- Entities (Nodes):
Service, Error, Person, Action, RootCause, Tool.
- Relationships (Edges):
CAUSED_BY, DEPENDS_ON, RESOLVED_BY, OBSERVED_IN.
- Key Challenge: Hallucination or missing context. Need to use constrained generation (Pydantic/Guardrails).
-
2. Storage (The Graph Database):
- Tech: Neo4j, ArangoDB, or NebulaGraph.
- Need to store metadata (timestamps, severity) on nodes/edges.
-
3. Retrieval Algorithms (Finding the answer):
- Scenario: An alert fires (e.g., "High Latency on Payment Service").
- Step 1: Entity Linking. Identify "Payment Service" and "High Latency" in the current incident.
- Step 2: Subgraph Matching. Find past postmortems connected to these entities.
- Step 3: Graph RAG (Retrieval-Augmented Generation). Don't just fetch text; fetch the topology of the past incident.
- Algorithms: PageRank (to find influential nodes), Community Detection (to find related clusters), Vector similarity (semantic match of error logs).
-
4. Suggestion Ranking (The "So What?"):
- We found 5 past incidents. Which one matters?
- Factors:
- Similarity score (Vector + Graph structural similarity).
- Recency (Graph decay functions).
- Success rate (Did the fix actually work?).
- Domain similarity (Is it the same microservice?).
- Logic: Weighted scoring system.
-
5. Continuous Learning (The Flywheel):
- Static data is bad. The graph must evolve.
- Explicit Feedback: User clicks "This helped."
- Implicit Feedback: Incident closed quickly after suggestion.
- Architecture: A feedback loop to adjust edge weights (confidence scores).
-
Structuring the Response:
- I will structure this as a technical architecture proposal or a system design document.
- Title: Project "Chronos" (or similar, maybe just "The System"). Let's stick to a descriptive title.
- Introduction: High-level value prop.
- Phase 1: Knowledge Extraction (Ingestion).
- Phase 2: The Graph Data Model.
- Phase 3: Retrieval & Reasoning.
- Phase 4: Ranking & Presentation.
- Phase 5: Continuous Learning.
- Conclusion.
-
Drafting the Content (Iterative Refinement):
- Extraction: Use an LLM with a defined ontology. Don't just dump text; structure it. Self-Correction: Mention "GraphRAG" concepts – summarizing communities of nodes.
- Retrieval: It's hybrid. Vector search finds the entry point, Graph traversal finds the context. Example: If Database A fails, check Postmortems for Service B that depends on Database A.
- Ranking: Define a formula.
Score = w1(SemanticSim) + w2(GraphDistance) + w3(Recency).
- Learning: Reinforcement Learning from Human Feedback (RLHF) is too complex for just this. Let's stick to "Weighted Edge Adjustment."
-
Refining the "Assistant" Aspect:
- The output shouldn't just be data. It needs to be conversational.
- "Based on INC-204, this looks like a deadlock. Check the connection pool."
-
Final Polish: Ensure technical terms are used correctly (e.g., Cypher, Vector Embeddings, RAG, Ontology). Add a section on "Tech Stack" to make it concrete.
(Self-Correction during drafting): Make sure to emphasize why postmortems are the data source. They contain the "Ground Truth" of cause and resolution, unlike logs which are just noise.
-
Output Generation: (This matches the detailed response provided previously.)
This is a system design and implementation blueprint for "Morpheus," a Graph-Based Incident Response Assistant. Unlike traditional RAG (Retrieval-Augmented Generation) systems that treat documents as flat text, Morpheus treats postmortems as interconnected evidence chains, modeling the topology of your infrastructure and the causality of your failures.
Below is the architectural breakdown covering Knowledge Extraction, Retrieval, Ranking, and Learning.
System Architecture Overview
Core Philosophy: Incidents are rarely novel; they are often rhymes of previous failures. By structuring postmortems into a Knowledge Graph (KG), we move from keyword search ("error 500") to structural reasoning ("Database A locked, causing Service B to timeout, which triggered Cascading Failure C").
Tech Stack Recommendations:
- Graph Database: Neo4j (for schema enforcement & Cypher) or ArangoDB.
- LLM: GPT-4o or Claude 3.5 Sonnet (for high-accuracy extraction).
- Orchestrator: LangGraph or LlamaIndex.
- Vector Store: Qdrant or Weaviate (for hybrid search).
Phase 1: Knowledge Extraction (The "Parser")
The ingestion pipeline converts unstructured Markdown/HTML postmortems into a structured Property Graph. This is not just Named Entity Recognition (NER); it is relationship extraction.
1. The Ontology (Schema Design)
We define a schema that reflects incident dynamics:
- Nodes (Entities):
Service (e.g., "Payment-API")
FailureMode (e.g., "OOM Kill", "Latency Spike")
Artifact (e.g., "Kafka Topic", "DB Table")
Action (e.g., "Rollback", "Scale Vertically")
RootCause (the fundamental "Why")
- Edges (Relationships):
(:Service)-[:DEPENDS_ON]->(:Service)
(:FailureMode)-[:TRIGGERED]->(:FailureMode) (Cascading failure)
(:RootCause)-[:MANIFESTED_AS]->(:FailureMode)
(:Action)-[:MITIGATED]->(:FailureMode)
2. Graph Construction Pipeline
We use an LLM to extract these objects from raw text.
- Prompt Strategy: "Read the following text. Extract all services, errors, and commands. Identify causal links. Output strictly in JSON."
- Entity Resolution: The parser might output "DB" in one paragraph and "Postgres" in another. A deduplication layer (using fuzzy matching or embedding similarity) merges these into a single node in the graph.
- Community Detection: Algorithms (like Leiden) run on the graph to cluster tightly coupled services, identifying "High Risk Zones" automatically.
Phase 2: Retrieval Algorithms (The "Responder")
When an engineer describes an incident, Morpheus performs Hybrid Graph Retrieval.
1. Entity Linking & Subgraph Extraction
- Input: "Payment service is returning 504s and CPU is high on the auth layer."
- Process: The system identifies entities (
Payment Service, Auth Layer, 504, High CPU). It anchors these to the graph nodes.
- Retrieval: It retrieves the k-hop neighborhood (e.g., 2 degrees of separation) around these nodes.
2. Multi-Vector Hop Retrieval
We do not just retrieve the graph nodes; we retrieve the raw text chunks linked to those nodes.
- If
Payment Service is implicated, retrieve the specific postmortem chunks where Payment Service was mentioned in the context of 504 errors.
- Vector Similarity: Used as a fallback for concepts not yet in the graph (e.g., "weird log message about octopus").
3. Structural Pathfinding
The system queries the graph for paths:
- Query:
MATCH (p:Service {name:'Payment'})-[:DEPENDS_ON]->(a:Service {name:'Auth'}) RETURN p, a
- Reasoning: "In 3 past postmortems, Payment failures were caused by Auth latency. Is Auth currently latency?"
Phase 3: Suggestion Ranking (The "Advisor")
The system retrieves 50 context pieces. It must rank them to show the engineer only the top 3 actionable insights.
1. Contextual Scoring Algorithm
A score is calculated for every retrieved postmortem segment:
Score=w1(S)+w2
- S (Semantic Similarity): Standard cosine similarity between the current incident log and the historical chunk.
- R (Recency): Exponential decay based on the date of the postmortem. A fix from 2020 is less relevant than one from last week.
- T (Topology Overlap): Jaccard similarity between the services involved in the current incident and the services in the historical postmortem.
- G (Graph Centrality): Is the retrieved
RootCause node connected to many other failures? (e.g., "DNS Config" is a high-centrality failure node).
2. Reranking with LLM
The top 10 candidates are passed to a lightweight LLM with a specific prompt:
"You are an SRE Lead. Rank these historical solutions based on their likelihood of fixing the current error: [Error Logs]. Consider the current infrastructure state."
Phase 4: Continuous Learning (The "Feedback Loop")
The graph evolves. It is not a static repository.
1. Implicit Feedback (Passive)
- Ranking Adjustment: If a user clicks "Copy Command" or "Upvote" on a suggestion, the edge weight between the
FailureMode and the Action is increased.
- Dwell Time: If a user reads a postmortem for 30 seconds, that node's relevance score increases.
2. Explicit Feedback (Active)
- The "Fix" Node: When the incident is resolved, the engineer inputs the actual resolution.
- Graph Updating: The system creates a new
Action node linked to the current incident.
- Contradiction Detection: If the engineer's fix contradicts the retrieved postmortem (e.g., "The docs said restart, but I had to patch the ENV variable"), the system flags this edge for review and lowers the confidence score of the old suggestion.
3. Drift Detection
If a Service changes its dependencies (detected via CI/CD integration), the relationships in the graph are automatically severed or updated, ensuring the retrieval logic matches current reality.
Example Interaction
Incident: Frontend latency spiking. Logs show ETIMEDOUT connecting to User-Profile-API.
Morpheus Logic:
- Graph Traversal: Finds
Frontend and User-Profile-API. Identifies edge (:Frontend)-[:CALLS]->(:User-Profile-API).
- Historical Match: Finds 2 postmortems where this specific connection caused outages.
- Root Cause Lifting: In both postmortems, the Root Cause was not the API, but the
Redis-Cache backing the API.
- Ranking: Prioritizes Redis metrics over API metrics.
Output to Engineer:
"I've identified a High Probability (88%) correlation with INC-204 and INC-309.
While the error is in User-Profile-API, previous incidents with this topology were caused by Redis-Cache connection pool exhaustion.
Suggested Actions:
- Check
Redis-Cache memory usage (Grafana Link).
- Flush the specific cache key for user profiles (Command:
redis-cli ...).
Relevant Postmortem Excerpt: '...The API timeouts were a symptom of the Redis blocking I/O...'"