Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1c89432
refactor(ai-markmap-agent): restructure prompts with persona/behavior…
lufftw Dec 13, 2025
b935491
refactor(ai-markmap-agent): redesign optimizer roles and add dynamic …
lufftw Dec 13, 2025
5a5ea12
feat(ai-markmap-agent): add configurable data sources and secure runt…
lufftw Dec 13, 2025
66eba5e
docs(config): add detailed English comments for problems load_mode op…
lufftw Dec 13, 2025
dd14907
refactor(ai-markmap-agent): simplify output naming config structure
lufftw Dec 13, 2025
2d4f55e
feat(ai-markmap-agent): implement complete multi-agent pipeline
lufftw Dec 13, 2025
59a73f9
fix(ai-markmap-agent): align prompt variables and add Markmap format …
lufftw Dec 13, 2025
a1ab216
fix(ai-markmap-agent): align prompt variables and add Markmap format …
lufftw Dec 13, 2025
c352a2e
feat(ai-markmap-agent): add data compression and URL configuration
lufftw Dec 13, 2025
fb45630
feat(ai-markmap-agent): implement comprehensive data compression
lufftw Dec 13, 2025
04c90a1
feat(ai-markmap-agent): add translate mode for zh-TW language generation
lufftw Dec 13, 2025
84fdfc9
fix(ai-markmap-agent): fix HTML markmap error and implement translate…
lufftw Dec 13, 2025
e610dd5
docs(ai-markmap-agent): add DESIGN_V2.md for new architecture
lufftw Dec 13, 2025
c55622b
docs(ai-markmap-agent): add DESIGN_V2.md for new architecture
lufftw Dec 13, 2025
0f84674
feat(ai-markmap-agent): add V2 config for judges, writer, and post-pr…
lufftw Dec 13, 2025
9931d45
feat(ai-markmap-agent): implement V2 workflow with writer and debate
lufftw Dec 13, 2025
a40056b
feat(ai-markmap-agent): add debug output config and switch to gpt-4 f…
lufftw Dec 13, 2025
34078c3
fix(ai-markmap-agent): fix LLM invocation in Judge, Writer, Translato…
lufftw Dec 13, 2025
504f9af
feat(ai-markmap-agent): add LLM call input/output saving for debugging
lufftw Dec 13, 2025
609ad53
chore: add outputs/debug/ to gitignore for ai-markmap-agent
lufftw Dec 13, 2025
04dccc7
feat(ai-markmap-agent): enhance debug output with data summary and LL…
lufftw Dec 13, 2025
58b87a1
feat(ai-markmap-agent): update HTML template to match unified markmap…
lufftw Dec 13, 2025
e7392a8
fix(ai-markmap-agent): fix data path resolution and prompt escaping
lufftw Dec 13, 2025
d860f71
fix(ai-markmap): use gpt-4o for generators to fix context length error
lufftw Dec 13, 2025
ace49d4
chore(config): upgrade summarizer model to gpt-4o for larger context
lufftw Dec 13, 2025
bb40aaf
feat(ai-markmap-agent): add V3 prompt templates for Structure Spec wo…
lufftw Dec 13, 2025
7bd3fde
feat(ai-markmap-agent): implement V3 multi-agent architecture
lufftw Dec 13, 2025
d10bcb7
fix(planner): use planner-specific prompts instead of generator prompts
lufftw Dec 13, 2025
74e8131
fix(v3-pipeline): resolve missing prompt variables and model config i…
lufftw Dec 13, 2025
c3c459c
refactor(ai-markmap-agent): remove V1/V2 pipeline, keep only V3
lufftw Dec 13, 2025
3b42aaf
refactor(ai-markmap-agent): remove V2 agents, keep only V3
lufftw Dec 13, 2025
f7c4122
refactor(ai-markmap-agent): remove V2, rename V3 to standard names
lufftw Dec 13, 2025
ccf195a
fix(ai-markmap-agent): use gpt-4o for translator to fix context lengt…
lufftw Dec 13, 2025
4b0d030
docs: Add DESIGN_V4.md with 2-round full discussion architecture
lufftw Dec 13, 2025
896b9d9
feat(ai-markmap-agent): implement refinement mode architecture
lufftw Dec 13, 2025
54a746f
fix: correct filename generation for translated outputs
lufftw Dec 13, 2025
e15f68b
feat(ai-markmap-agent): update output naming and add version history
lufftw Dec 13, 2025
1b55513
feat(ai-markmap-agent): add versioning mode (continue/reset)
lufftw Dec 13, 2025
4937239
fix(ai-markmap-agent): delay version cleanup until pipeline completes
lufftw Dec 13, 2025
d0153fe
feat: add translation-only script to avoid full pipeline execution
lufftw Dec 13, 2025
a6ff414
fix(translate_only): fix filename corruption when replacing language …
lufftw Dec 13, 2025
dac71af
fix(translate_only): fix HTML output directory and clean LLM artifacts
lufftw Dec 13, 2025
f6aeb15
fix(ai-markmap-agent): preserve YAML frontmatter in translation cleanup
lufftw Dec 13, 2025
982520c
fix(translator): use Taiwan CS terminology instead of Mainland China
lufftw Dec 13, 2025
bd9874a
fix(translate_only): ensure MD and HTML outputs use consistent direct…
lufftw Dec 13, 2025
4d22cf3
docs: simplify AI Mind Map Generation section with doc references
lufftw Dec 13, 2025
d4000e7
docs(mkdocs): add 6 missing files to navigation
lufftw Dec 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,26 @@ docs/mindmaps/*.md
!docs/mindmaps/README.md
!docs/mindmaps/neetcode_ontology_ai_*.md

# =============================================================================
# AI Markmap Agent (tools/ai-markmap-agent/)
# =============================================================================

# AI Markmap Agent - Output files
tools/ai-markmap-agent/outputs/intermediate/*.md
tools/ai-markmap-agent/outputs/intermediate/*.html
tools/ai-markmap-agent/outputs/final/*.md
tools/ai-markmap-agent/outputs/final/*.html
tools/ai-markmap-agent/outputs/debug/

# AI Markmap Agent - Data & persistence
tools/ai-markmap-agent/data/chromadb/
tools/ai-markmap-agent/data/*.json
tools/ai-markmap-agent/data/*.yaml

# AI Markmap Agent - Logs
tools/ai-markmap-agent/logs/*.log

# AI Markmap Agent - Environment (if not using root .env)
tools/ai-markmap-agent/.env
tools/ai-markmap-agent/.env.local

149 changes: 23 additions & 126 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Most people practice algorithms in isolation. We built an **interconnected knowl

| Mind Map | Description | Link |
|:---------|:------------|:----:|
| 🤖 **AI Ontology Analysis (Evolved)** | Generated via a multi-agent pipeline | [🔗 EN](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_agent_evolved_en.html) · [🔗 中文](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_agent_evolved_zh-TW.html) |
| 🤖 **AI Ontology Analysis** | AI-powered deep pattern synthesis | [🔗 EN](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_ai_en.html) · [🔗 中文](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_ai_zh-TW.html) |
| 📐 **Pattern Hierarchy** | API kernels → patterns → solutions | [🔗](https://lufftw.github.io/neetcode/pages/mindmaps/pattern_hierarchy.html) |
| 👨‍👩‍👧‍👦 **Family Derivation** | Base templates → derived variants | [🔗](https://lufftw.github.io/neetcode/pages/mindmaps/family_derivation.html) |
Expand Down Expand Up @@ -275,6 +276,8 @@ Our **AI Ontology Analyzer** processes the entire knowledge graph — API Kernel

| Language | Description | Links |
|:---------|:------------|:------|
| **English (Evolved)** | Generated via a multi-agent pipeline | [Static](docs/mindmaps/neetcode_ontology_agent_evolved_en.md) · [Interactive ✨](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_agent_evolved_en.html) |
| **繁體中文 (Evolved)** | 由多代理(multi-agent)流程產生 | [Static](docs/mindmaps/neetcode_ontology_agent_evolved_zh-TW.md) · [Interactive ✨](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_agent_evolved_zh-TW.html) |
| **English** | AI-synthesized pattern relationships | [Static](docs/mindmaps/neetcode_ontology_ai_en.md) · [Interactive ✨](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_ai_en.html) |
| **繁體中文** | AI 智能分析模式關聯 | [Static](docs/mindmaps/neetcode_ontology_ai_zh-TW.md) · [Interactive ✨](https://lufftw.github.io/neetcode/pages/mindmaps/neetcode_ontology_ai_zh-TW.html) |

Expand Down Expand Up @@ -306,139 +309,33 @@ Our **AI Ontology Analyzer** processes the entire knowledge graph — API Kernel

## 🤖 AI Mind Map Generation

> **"The synthesis of a Software Architect's system thinking, an Algorithm Professor's pedagogical wisdom, a Principal Engineer's battle-tested experience, and a Competitive Programming Champion's pattern recognition — all unified through AI."**

### The Vision

Traditional algorithm learning resources present knowledge in isolation. Our **AI Ontology Analyzer** takes a fundamentally different approach:

| Traditional Approach | Our AI Approach |
|:---------------------|:----------------|
| Static problem lists | Dynamic knowledge graph synthesis |
| Manual categorization | AI-discovered pattern relationships |
| Single perspective | Multi-perspective expert synthesis |
| Memorize solutions | Understand interconnections |

### How It Works

```
┌─────────────────────────────────────────────────────────────────┐
│ KNOWLEDGE GRAPH INPUT │
├─────────────────────────────────────────────────────────────────┤
│ ontology/ │ meta/problems/ │ docs/patterns/ │
│ ├── api_kernels │ ├── 0001_*.toml │ ├── sliding_window │
│ ├── patterns │ ├── 0003_*.toml │ └── ... │
│ ├── algorithms │ └── ... │ │
│ └── ... │ │ │
└─────────────────────┴─────────────────────┴─────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ AI SYNTHESIS ENGINE │
├─────────────────────────────────────────────────────────────────┤
│ 🏗️ Software Architect → System-level pattern organization │
│ 📚 Algorithm Professor → Pedagogical structure & progression │
│ ⚙️ Principal Engineer → Practical applicability & trade-offs│
│ 🏆 Competitive Champion → Pattern recognition shortcuts │
│ 🎨 API Designer → Clean knowledge interfaces │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ INTELLIGENT OUTPUT │
├─────────────────────────────────────────────────────────────────┤
│ ✅ Smart Links: GitHub solution (if exists) → LeetCode fallback│
│ ✅ Multi-language: EN / 繁體中文 / 简体中文 │
│ ✅ Markmap format: Interactive, collapsible, beautiful │
│ ✅ Custom goals: Interview prep / Systematic learning / Review │
└─────────────────────────────────────────────────────────────────┘
```

### Quick Start

```bash
# Interactive mode (recommended)
python tools/generate_mindmaps_ai.py

# Specific goals
python tools/generate_mindmaps_ai.py --goal interview # Interview preparation
python tools/generate_mindmaps_ai.py --goal systematic # Learning roadmap
python tools/generate_mindmaps_ai.py --goal pattern_mastery # Deep pattern analysis

# Focus on specific topic
python tools/generate_mindmaps_ai.py --topic sliding_window
python tools/generate_mindmaps_ai.py --topic dynamic_programming

# Multiple languages
# Configure in tools/mindmap_ai_config.toml:
# language = ["en", "zh-TW"]
```

### 🔄 Automatic Generation (Local CI/CD)

**Auto-generate AI mind maps on commit** using pre-commit hooks:

```bash
# Install pre-commit hooks
pip install pre-commit
pre-commit install
```

When you commit changes to `ontology/`, `meta/problems/`, or `tools/generate_mindmaps.py`, the hook automatically runs AI mind map generation.

**Skip when needed:**
```bash
# Skip with commit message
git commit -m "Update ontology [skip-ai]"

# Skip with environment variable
SKIP_AI_MINDMAPS=true git commit -m "Update ontology"
```

> 📖 See [tools/README.md](tools/README.md#-local-cicd-automation) for complete setup and usage guide.

### Configuration

Edit `tools/mindmap_ai_config.toml` to customize:

| Section | What You Can Configure |
|:--------|:-----------------------|
| `[model]` | LLM model, temperature, max tokens |
| `[output]` | Directory, filename, HTML generation |
| `[ontology]` | Which knowledge graph data to include |
| `[problems]` | Problem filters (difficulty, topics, roadmaps) |
| `[generation]` | Goal, style, custom instructions |
| `[links]` | GitHub repo URL, branch, link format |
| `[advanced]` | Output language(s), complexity inclusion |

### The Intelligence Behind It
> **"Let AI synthesize what takes humans years to internalize."**

The AI doesn't just reorganize data — it **synthesizes understanding** from multiple expert perspectives:
### Two Generation Modes

| Perspective | Contribution to Mind Map |
|:------------|:-------------------------|
| 🏗️ **Software Architect** | Identifies abstraction layers, sees patterns as reusable components |
| 📚 **Algorithm Professor** | Structures learning progression, explains "why" not just "how" |
| ⚙️ **Principal Engineer** | Highlights production trade-offs, real-world applicability |
| 🏆 **Competitive Champion** | Surfaces pattern-matching shortcuts, time-pressure optimizations |
| 🎨 **API Designer** | Creates clean knowledge interfaces, consistent naming |
| 👥 **Open Source Advocate** | Makes knowledge discoverable, contribution-friendly |
| Mode | Description | Quick Start |
|:-----|:------------|:------------|
| **🤖 Evolved Agent** | Multi-expert refinement with consensus voting | `cd tools/ai-markmap-agent && python main.py` |
| **🤖 Basic AI** | Single-pass synthesis from knowledge graph | `python tools/generate_mindmaps_ai.py` |

### Output Examples
### Key Features

**With Solution (links to GitHub):**
```markdown
- [LeetCode 3 - Longest Substring Without Repeating](https://github.com/lufftw/neetcode/blob/main/solutions/0003_longest_substring_without_repeating_characters.py)
```
- 🧬 **Multi-Expert Synthesis** — Architect + Professor + Engineer perspectives
- 🎯 **Smart Linking** — GitHub solution (if exists) → LeetCode fallback
- 🌐 **Multi-language** — EN / 繁體中文
- ♻️ **Regeneratable** — Version history with auto-increment

**Without Solution (links to LeetCode):**
```markdown
- [LeetCode 121 - Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)
```
### Output Files

### No API Key? No Problem
| Type | Output Path |
|:-----|:------------|
| **Evolved** | `docs/mindmaps/neetcode_ontology_agent_evolved_{lang}.md` |
| **Basic** | `docs/mindmaps/neetcode_ontology_ai_{lang}.md` |
| **HTML** | `docs/pages/mindmaps/*.html` |

The generator saves the complete prompt to `tools/prompts/generated/mindmap_prompt.md`. Copy and paste it into ChatGPT, Claude, or any LLM web interface.
> 📖 **Evolved Agent**: See [`tools/ai-markmap-agent/README.md`](tools/ai-markmap-agent/README.md) for architecture, expert roles, and configuration.
>
> 📖 **Basic AI**: See [`tools/README.md`](tools/README.md) for configuration options.

---

Expand Down
Loading