Knowledge Graph Architecture
Platform-Agnostic Knowledge Management System
This document describes the core architectural concepts behind the knowledge graph system.
Core Concept: The Four-Pillar Memoryβ
The knowledge graph uses four complementary knowledge systems, each optimized for different purposes:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FOUR-PILLAR MEMORY β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β Lessons Learned β β ADRs β β
β β (Deep Dive) β β (Formal) β β
β β β β β β
β β β’ Problem β β β’ Context β β
β β β’ Root Cause β β β’ Options β β
β β β’ Solution β β β’ Decision β β
β β β’ Replication β β β’ Consequences β β
β β β’ Lessons β β β β
β β β β β β
β β 5-10 min read β β 3-5 min read β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β Knowledge Graph β βSession Summaries β β
β β (Quick Ref) β β (Historical) β β
β β β β β β
β β β’ Patterns β β β’ Overview β β
β β β’ Concepts β β β’ Built β β
β β β’ Gotchas β β β’ Decided β β
β β β β β’ Learned β β
β β 5-10 sec scan β β β’ Next β β
β β β β β β
β β Links to lessons β β 2-3 min scan β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The LEVERAGE Principleβ
Knowledge Graph and Lessons Learned work together:
-
KG = Quick Reference (5-10 seconds)
- Scan while working
- Quick answer to "what is this?"
- Links to deeper dive
-
Lessons = Deep Dive (5-10 minutes)
- Read when needed
- Full context and rationale
- Replication steps
Bidirectional relationship:
- KG links to detailed lessons ("see lesson for full context")
- Lessons extract to KG entries ("key insights for quick reference")
- Start with KG, drill into Lessons as needed
Information Flowβ
βββββββββββββββ
β WORK β
β (Problems, β
β Decisions, β
β Learning) β
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββββββββββ
β CAPTURE β
β β
β β’ Lesson Learned β β Detailed problem-solving journey
β β’ ADR β β Formal architectural decision
β β’ Session Summary β β Work session snapshot
ββββββββ¬βββββββββββββββ
β
β (Extract key insights)
βΌ
βββββββββββββββββββββββ
β KNOWLEDGE GRAPH β
β β
β β’ Pattern β β Extracted from lesson
β β’ Concept β β Distilled from ADR
β β’ Gotcha β β Common pitfall documented
ββββββββ¬βββββββββββββββ
β
β (Bidirectional sync)
βΌ
βββββββββββββββββββββββ
β PROJECT MEMORY β
β β
β β’ MEMORY.md β β Platform persistent context
β β’ Git metadata β β Commits, branches, issues
βββββββββββββββββββββββ
Capture β Extract β Syncβ
- Capture: Document problem-solving in Lessons Learned or ADRs
- Extract: Pull key insights into Knowledge Graph for quick reference
- Sync: Update project memory (MEMORY.md) with new knowledge
Automation: The /kmgraph:sync-all command orchestrates this entire flow.
Directory Structureβ
project/
βββ docs/
β βββ lessons-learned/ # PILLAR 1: Detailed narratives
β β βββ architecture/ # System design lessons
β β βββ debugging/ # Troubleshooting journeys
β β βββ process/ # Workflow improvements
β β βββ patterns/ # Design pattern discoveries
β β
β βββ decisions/ # PILLAR 2: Formal ADRs
β β βββ ADR-001.md # Numbered decisions
β β βββ ADR-002.md
β β βββ ...
β β
β βββ knowledge/ # PILLAR 3: Quick reference
β β βββ patterns.md # Design patterns catalog
β β βββ concepts.md # Core concepts definitions
β β βββ gotchas.md # Common pitfalls
β β
β βββ sessions/ # PILLAR 4: Historical snapshots
β βββ 2024-12/
β βββ session-001.md
β βββ session-002.md
β
βββ MEMORY.md # Platform persistent context
Why This Structure?β
Separation by purpose:
- Lessons: "How we solved X" (narrative, chronological)
- ADRs: "Why we chose Y" (decision rationale, formal)
- Knowledge Graph: "Quick facts about Z" (reference, timeless)
- Sessions: "What happened when" (snapshots, historical)
Different longevity:
- Lessons & ADRs: Permanent (referenced years later)
- Knowledge Graph: Evolving (updated as understanding improves)
- Sessions: Historical (snapshot, not updated)
Knowledge Capture Workflowβ
Manual (No Automation)β
# 1. Copy template
cp core/templates/lessons-learned/lesson-template.md \
docs/lessons-learned/process/my-lesson.md
# 2. Fill in sections
vim docs/lessons-learned/process/my-lesson.md
# 3. Update category README
vim docs/lessons-learned/process/README.md
# Add link to my-lesson.md
# 4. Extract to knowledge graph (manual)
vim docs/knowledge/patterns.md
# Add pattern extracted from lesson
# 5. Commit
git add docs/
git commit -m "docs: add lesson on my-topic"
Automated (Claude Code)β
# Single command does all steps
/kmgraph:capture-lesson
# Prompts for:
# - Topic
# - Category (auto-detected)
# - Content
# Automatically:
# - Creates from template
# - Adds git metadata
# - Updates category README
# - Commits with standard message
# - (Optional) Updates knowledge graph
Full Pipeline (Sync-All)β
/kmgraph:sync-all
# Orchestrates:
# 1. Capture lesson (if applicable)
# 2. Update knowledge graph
# 3. Update MEMORY.md
# 4. Create session summary
# 5. Commit everything with links
Scalabilityβ
Small Project (1-5 people)β
- Lessons: 10-50 total
- ADRs: 5-15 total
- KG entries: 20-100 across patterns/concepts/gotchas
- Management: Manual browsing, grep search
Medium Project (6-20 people)β
- Lessons: 50-200 total
- ADRs: 15-50 total
- KG entries: 100-300
- Management: Category organization, search tools, curator role
Large Project (20+ people)β
- Lessons: 200+ total
- ADRs: 50+ total
- KG entries: 300+
- Management: Tag system, dedicated search, knowledge subteam
Archival Strategyβ
For very large knowledge bases:
docs/
βββ lessons-learned/
β βββ 2024/ # Active year
β βββ archive/
β βββ 2023/ # Previous years
β βββ 2022/
Archive lessons older than 2 years (still searchable, just organized).
Privacy & Sanitization Architectureβ
Layers of Protectionβ
- Templates: No sensitive data by default
- Examples: All generalized, no real data
- Pre-commit Hook: Scans for patterns before commit
- Sanitization Checklist: Manual review before sharing