Skip to content

Commit 66ebcbe

Browse files
chanjunrenclaude
andcommitted
✨ Add AI agents zettelkasten notes and learning roadmap
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a84b2df commit 66ebcbe

11 files changed

Lines changed: 581 additions & 27 deletions

β€Žwww/docs/.obsidian/graph.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"repelStrength": 10,
1818
"linkStrength": 1,
1919
"linkDistance": 250,
20-
"scale": 0.17381088240350975,
20+
"scale": 0.6602095825678339,
2121
"close": true
2222
}

β€Žwww/docs/.obsidian/workspace.jsonβ€Ž

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
"type": "split",
55
"children": [
66
{
7-
"id": "86d32c8db5d81679",
7+
"id": "f379a2c73e5e9e5b",
88
"type": "tabs",
99
"children": [
1010
{
11-
"id": "e7dd040f4c4e53f7",
11+
"id": "4d4c5c29d81de5aa",
1212
"type": "leaf",
1313
"state": {
14-
"type": "markdown",
15-
"state": {
16-
"file": "zettelkasten/infrastructure/tools/tmux.md",
17-
"mode": "source",
18-
"source": false
19-
}
14+
"type": "graph",
15+
"state": {}
2016
}
2117
}
2218
]
@@ -85,7 +81,6 @@
8581
"state": {
8682
"type": "backlink",
8783
"state": {
88-
"file": "zettelkasten/infrastructure/tools/tmux.md",
8984
"collapseAll": false,
9085
"extraContext": false,
9186
"sortOrder": "alphabetical",
@@ -102,7 +97,6 @@
10297
"state": {
10398
"type": "outgoing-link",
10499
"state": {
105-
"file": "zettelkasten/infrastructure/tools/tmux.md",
106100
"linksCollapsed": false,
107101
"unlinkedCollapsed": true
108102
}
@@ -124,9 +118,7 @@
124118
"type": "leaf",
125119
"state": {
126120
"type": "outline",
127-
"state": {
128-
"file": "zettelkasten/infrastructure/tools/tmux.md"
129-
}
121+
"state": {}
130122
}
131123
}
132124
]
@@ -146,8 +138,20 @@
146138
"command-palette:Open command palette": false
147139
}
148140
},
149-
"active": "e7dd040f4c4e53f7",
141+
"active": "4d4c5c29d81de5aa",
150142
"lastOpenFiles": [
143+
"zettelkasten/concepts/ai-agents/ai_systems_learning_roadmap.md",
144+
"zettelkasten/concepts/ai-agents/agent_memory_and_state.md",
145+
"zettelkasten/concepts/ai-agents/llm_tool_use.md",
146+
"zettelkasten/concepts/ai-agents/custom_mcp_servers.md",
147+
"zettelkasten/concepts/ai-agents/model_context_protocol.md",
148+
"zettelkasten/concepts/ai-agents/agent_as_tool_pattern.md",
149+
"zettelkasten/concepts/ai-agents/coordinator_router_pattern.md",
150+
"zettelkasten/concepts/ai-agents/loop_review_critique_pattern.md",
151+
"zettelkasten/concepts/ai-agents/agentic_design_patterns.md",
152+
"zettelkasten/concepts/ai-agents",
153+
"zettelkasten/infrastructure/monitoring/micrometer_promql_cheatsheet.md",
154+
"zettelkasten/infrastructure/tools/tmux.md",
151155
"zettelkasten/infrastructure/tools/postman_scripts_cheatsheet.md",
152156
"zettelkasten/backend/languages/mvel_overview.md",
153157
"zettelkasten/backend/languages/groovy_closures.md",
@@ -165,25 +169,13 @@
165169
"zettelkasten/backend/languages/java/class_loading.md",
166170
"zettelkasten/backend/languages/java/java_synchronization_pitfalls.md",
167171
"zettelkasten/backend/languages/java/java_double_checked_locking.md",
168-
"zettelkasten/backend/languages/java/java_concurrency_data_structures.md",
169-
"zettelkasten/backend/languages/java/java_concurrency_guidelines.md",
170-
"zettelkasten/backend/languages/java/java_synchronized.md",
171172
"zettelkasten/backend/languages/java",
172-
"zettelkasten/backend/frameworks/java/java_synchronization_pitfalls.md",
173-
"zettelkasten/backend/frameworks/java/java_double_checked_locking.md",
174-
"zettelkasten/backend/concepts/fundamentals/compare_and_swap.md",
175-
"zettelkasten/backend/concepts/fundamentals/cpu_cache_and_memory_visibility.md",
176173
"zettelkasten/backend/concepts/fundamentals",
177174
"zettelkasten/backend/concepts",
178-
"zettelkasten/backend/frameworks/java/java_synchronized.md",
179-
"zettelkasten/home/practical_interior_design.md",
180175
"zettelkasten/home",
181-
"zettelkasten/backend/libraries/caffeine/caffeine-refresh-vs-expire.md",
182176
"zettelkasten/backend/libraries/caffeine",
183177
"zettelkasten/backend/libraries",
184-
"zettelkasten/caffeine-refresh-vs-expire.md",
185178
"zettelkasten/finance/investing/general",
186-
"zettelkasten/finance/investing/options",
187179
"assets/Pasted image 20250828105751.png",
188180
"assets/skating_technical_tricks_matrix.png",
189181
"assets/3js_textures_albedo_example.png",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
πŸ—“οΈ 21032026 2100
2+
3+
# agent_as_tool_pattern
4+
5+
> Primary agent maintains full control and state, using sub-agents as stateless tools
6+
7+
## How It Works
8+
9+
1. **Primary agent** owns the entire workflow and state
10+
2. Calls sub-agents as **stateless functions** β€” they execute a specific task and return results
11+
3. Primary agent decides what to do next based on returned results
12+
4. Sub-agents have no awareness of the broader workflow
13+
14+
## Key Difference from Coordinator
15+
16+
| | Coordinator | Agent as Tool |
17+
|---|---|---|
18+
| **Control** | Delegates control to sub-agents | Primary agent retains full control |
19+
| **State** | Sub-agents may manage their own state | Sub-agents are stateless |
20+
| **Analogy** | Manager delegating work | Craftsman using tools |
21+
22+
## When to Use
23+
24+
- Primary agent needs **fine-grained control** over workflow progression
25+
- Workflow state must be **centrally managed** (e.g., decisions depend on accumulated context)
26+
- Sub-agent outputs need to be **composed or transformed** before the next step
27+
28+
## Trade-offs
29+
30+
| Pros | Cons |
31+
|---|---|
32+
| Centralized state = easier to reason about overall flow | Primary agent becomes a bottleneck |
33+
| Fine-grained decision making between steps | Similar structural complexity to coordinator |
34+
| Sub-agents are simpler (stateless, single-purpose) | Primary agent prompt can grow complex |
35+
36+
---
37+
## References
38+
- [[agentic_design_patterns]]
39+
- [[coordinator_router_pattern]] β€” alternative approach where coordinator delegates control
40+
- [Advanced Agentic Patterns for Multi-Agent Systems](https://youtu.be/89KKm_a4M7A?si=PyQjItG2hIG0Bsn4)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
πŸ—“οΈ 21032026 2100
2+
3+
# agent_memory_and_state
4+
5+
> How agents retain, retrieve, and manage information across interactions to maintain coherent behavior over time
6+
7+
## Why Agents Need Memory
8+
9+
Without memory, every LLM call is stateless β€” the agent has no context beyond what's in the current prompt. Memory enables agents to:
10+
11+
- **Maintain context** across multi-step tasks (remembering what's been done)
12+
- **Learn from past interactions** (avoiding repeated mistakes)
13+
- **Personalize behavior** (adapting to user preferences)
14+
- **Coordinate with other agents** (sharing discovered information)
15+
16+
## Types of Memory
17+
18+
| Type | What It Stores | Lifespan | Storage Approach |
19+
|---|---|---|---|
20+
| **Short-term** | Current conversation / task context | Single session | Context window (message history) |
21+
| **Long-term** | Facts, preferences, learned knowledge | Persistent | Vector DB, key-value store, file system |
22+
| **Episodic** | Specific past interactions and outcomes | Persistent | Structured logs, indexed by time/task |
23+
24+
### Short-term Memory
25+
26+
The simplest form β€” just the conversation history passed in the LLM's context window. Effective but limited by token count. Strategies to manage it:
27+
28+
- **Sliding window**: keep the last N messages
29+
- **Summarization**: periodically compress older messages into a summary
30+
- **Selective retention**: keep messages marked as important, drop the rest
31+
32+
### Long-term Memory
33+
34+
Persistent knowledge that survives across sessions. Typically involves:
35+
36+
- **Embedding + vector search**: store information as vectors, retrieve by semantic similarity
37+
- **Structured storage**: key-value pairs, relational DB for structured facts
38+
- **File-based**: markdown files, JSON β€” simple but effective for smaller knowledge bases
39+
40+
### Episodic Memory
41+
42+
Records of what happened in specific past interactions β€” useful for learning from experience:
43+
44+
- What task was attempted and what approach was taken
45+
- Whether the approach succeeded or failed
46+
- What the user's feedback was
47+
48+
## State Management Approaches
49+
50+
| Approach | How It Works | Best For |
51+
|---|---|---|
52+
| **Centralized** | Single state store shared by all agents | [[coordinator_router_pattern]], simpler multi-agent setups |
53+
| **Distributed** | Each agent maintains its own state | Loosely coupled agents, parallel execution |
54+
| **External** | State stored in external system (DB, cache) | Production systems, persistence across restarts |
55+
56+
## How Memory Affects Pattern Selection
57+
58+
| Pattern | Memory Considerations |
59+
|---|---|
60+
| **Single agent** | Short-term context usually sufficient |
61+
| **[[coordinator_router_pattern]]** | Coordinator needs memory of subtask results; sub-agents may be stateless |
62+
| **[[agent_as_tool_pattern]]** | Primary agent holds all state; sub-agent tools are deliberately stateless |
63+
| **[[loop_review_critique_pattern]]** | Needs memory of previous iterations to avoid repeating the same fixes |
64+
65+
## Practical Considerations
66+
67+
| Concern | Detail |
68+
|---|---|
69+
| **Token limits** | Context window is finite β€” aggressive summarization or retrieval needed for long tasks |
70+
| **Retrieval quality** | Vector search isn't perfect β€” irrelevant memories can mislead the agent |
71+
| **Staleness** | Stored facts can become outdated β€” need expiration or validation strategies |
72+
| **Cost** | Every memory retrieved and injected into context costs tokens |
73+
| **Privacy** | Persistent memory may store sensitive information β€” consider retention policies |
74+
75+
---
76+
## References
77+
- [[agentic_design_patterns]]
78+
- [[agent_as_tool_pattern]]
79+
- [[coordinator_router_pattern]]
80+
- [MemGPT: Towards LLMs as Operating Systems (arXiv)](https://arxiv.org/abs/2310.08560)
81+
- [LangChain Memory Documentation](https://python.langchain.com/docs/concepts/memory/)
82+
- [LlamaIndex Agent Memory](https://docs.llamaindex.ai/en/stable/understanding/agent/memory/)
83+
- [LLM Powered Autonomous Agents β€” Lilian Weng](https://lilianweng.github.io/posts/2023-06-23-agent/)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
πŸ—“οΈ 21032026 2100
2+
3+
# agentic_design_patterns
4+
5+
> Architectural patterns for building AI agent systems, ranging from simple single-agent setups to complex multi-agent orchestrations
6+
7+
## Overview
8+
9+
Agentic patterns define how AI agents are structured, coordinated, and controlled to accomplish tasks. Choosing the right pattern involves trade-offs between **control**, **flexibility**, **cost/latency**, and **complexity**.
10+
11+
## Pattern Comparison
12+
13+
| Pattern | Use Case | Control | Flexibility | Cost & Latency | Complexity |
14+
|---|---|---|---|---|---|
15+
| **Single Agent** | Simple prototypes | Full (one agent) | Low | Low | Low |
16+
| **Sequential / Parallel** | Structured workflows | Moderate | Moderate | Moderate | Moderate |
17+
| **[[loop_review_critique_pattern]]** | Tasks with strict criteria | Iterative | Moderate | High (loops) | High |
18+
| **[[coordinator_router_pattern]]** | Complex task routing | Delegated | High | High | High |
19+
| **[[agent_as_tool_pattern]]** | Fine control with sub-agents | Full (primary) | High | High | High |
20+
21+
## Key Takeaways
22+
23+
- **Single / Sequential / Parallel** agents suit most straightforward workflows
24+
- **Loop agents** shine when outputs must meet non-negotiable constraints (e.g., budget limits, safety checks)
25+
- **Coordinator agents** excel at decomposing complex requests into subtasks handled by specialists
26+
- **Agent-as-tool** keeps centralized state management while leveraging specialized capabilities
27+
- More advanced patterns increase latency and cost β€” only use them when simpler patterns fall short
28+
- Foundational concepts: [[llm_tool_use]] (how agents interact with external functions) and [[agent_memory_and_state]] (how agents retain context across steps)
29+
30+
---
31+
## References
32+
- [Advanced Agentic Patterns for Multi-Agent Systems](https://youtu.be/89KKm_a4M7A?si=PyQjItG2hIG0Bsn4)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
πŸ—“οΈ 21032026 2100
2+
3+
# ai_systems_learning_roadmap
4+
5+
> A structured reading and learning plan progressing from LLM fundamentals to building custom AI tool implementations
6+
7+
## Phase 1: Foundations
8+
9+
**Goal**: understand how LLMs work and how they interact with tools
10+
11+
| Resource | Type | Link |
12+
|---|---|---|
13+
| Andrej Karpathy β€” "Intro to Large Language Models" | Video | [YouTube](https://www.youtube.com/watch?v=zjkBMFhNj_g) |
14+
| Anthropic β€” Tool Use Documentation | Docs | [docs.anthropic.com](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview) |
15+
| OpenAI β€” Function Calling Guide | Docs | [platform.openai.com](https://platform.openai.com/docs/guides/function-calling) |
16+
17+
Zettelkasten: [[llm_tool_use]]
18+
19+
## Phase 2: Agent Patterns
20+
21+
**Goal**: learn how agents are architected and when to use which pattern
22+
23+
| Resource | Type | Link |
24+
|---|---|---|
25+
| Lilian Weng β€” "LLM Powered Autonomous Agents" | Blog | [lilianweng.github.io](https://lilianweng.github.io/posts/2023-06-23-agent/) |
26+
| Andrew Ng β€” Agentic Design Patterns (DeepLearning.AI) | Video | [deeplearning.ai](https://www.deeplearning.ai/the-batch/how-agents-can-improve-llm-performance/) |
27+
| Anthropic β€” "Building Effective Agents" | Blog | [anthropic.com](https://www.anthropic.com/engineering/building-effective-agents) |
28+
29+
Zettelkasten: [[agentic_design_patterns]], [[agent_memory_and_state]]
30+
31+
## Phase 3: MCP & Tool Infrastructure
32+
33+
**Goal**: understand the protocol layer that connects agents to tools at scale
34+
35+
| Resource | Type | Link |
36+
|---|---|---|
37+
| MCP Official Documentation | Docs | [modelcontextprotocol.io](https://modelcontextprotocol.io/introduction) |
38+
| MCP Quickstart β€” Building a Server | Tutorial | [modelcontextprotocol.io](https://modelcontextprotocol.io/quickstart/server) |
39+
| MCP Quickstart β€” Building a Client | Tutorial | [modelcontextprotocol.io](https://modelcontextprotocol.io/quickstart/client) |
40+
41+
Zettelkasten: [[model_context_protocol]], [[custom_mcp_servers]]
42+
43+
## Phase 4: Build Your Own
44+
45+
**Goal**: hands-on implementation to solidify understanding
46+
47+
| Project | Description | Starting Point |
48+
|---|---|---|
49+
| **Custom MCP Server** | Expose an internal API or database via MCP. Start with stdio transport, then add HTTP | [MCP Server Quickstart](https://modelcontextprotocol.io/quickstart/server) |
50+
| **Agent with Tool Use** | Build an agent that uses tools to accomplish a multi-step task | [Anthropic SDK](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview), [LangChain Agents](https://python.langchain.com/docs/concepts/agents/), [LlamaIndex Agents](https://docs.llamaindex.ai/en/stable/understanding/agent/) |
51+
| **Multi-Agent System** | Combine multiple agents using your custom MCP tools β€” try coordinator or agent-as-tool pattern | [[coordinator_router_pattern]], [[agent_as_tool_pattern]] |
52+
53+
## Phase 5: Advanced Topics
54+
55+
**Goal**: deeper exploration for production-grade systems
56+
57+
| Topic | What to Explore |
58+
|---|---|
59+
| **RAG (Retrieval-Augmented Generation)** | Embedding models, vector databases, chunking strategies, hybrid search |
60+
| **Agent Evaluation & Observability** | Tracing agent runs, measuring tool call accuracy, detecting loops/hallucinations |
61+
| **Production Concerns** | Guardrails, cost management, latency optimization, rate limiting, error recovery |
62+
63+
---
64+
## References
65+
- [[llm_tool_use]]
66+
- [[agentic_design_patterns]]
67+
- [[agent_memory_and_state]]
68+
- [[model_context_protocol]]
69+
- [[custom_mcp_servers]]
70+
- [Andrej Karpathy β€” Intro to Large Language Models (YouTube)](https://www.youtube.com/watch?v=zjkBMFhNj_g)
71+
- [Lilian Weng β€” LLM Powered Autonomous Agents](https://lilianweng.github.io/posts/2023-06-23-agent/)
72+
- [Anthropic β€” Building Effective Agents](https://www.anthropic.com/engineering/building-effective-agents)
73+
- [MCP Official Documentation](https://modelcontextprotocol.io/introduction)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
πŸ—“οΈ 21032026 2100
2+
3+
# coordinator_router_pattern
4+
5+
> Hierarchical task decomposition where a top-level coordinator routes subtasks to specialized agents
6+
7+
## How It Works
8+
9+
1. **Coordinator agent** receives a complex user request
10+
2. Analyzes and decomposes it into subtasks
11+
3. Routes each subtask to the appropriate **specialized sub-agent**
12+
4. Sub-agents can themselves be sequential or parallel workflows
13+
5. Coordinator aggregates results and returns a unified response
14+
15+
```
16+
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
17+
β”‚ Coordinator β”‚
18+
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
19+
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
20+
β–Ό β–Ό β–Ό
21+
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
22+
β”‚ Food & β”‚ β”‚ Nearby β”‚ β”‚ Trip β”‚
23+
β”‚ Transport β”‚ β”‚ Places β”‚ β”‚ Cost β”‚
24+
β”‚(sequential)β”‚ β”‚(parallel) β”‚ β”‚ β”‚
25+
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
26+
```
27+
28+
## Analogy
29+
30+
Acts like a **project manager** β€” understands the big picture, delegates to specialists, and assembles the final deliverable.
31+
32+
## When to Use
33+
34+
- Complex requests that naturally decompose into **independent subtasks**
35+
- When specialized agents exist for different domains (search, calculation, generation)
36+
- When subtasks benefit from different execution strategies (some sequential, some parallel)
37+
38+
## Trade-offs
39+
40+
| Pros | Cons |
41+
|---|---|
42+
| Highly flexible β€” handles diverse complex problems | Routing overhead adds latency |
43+
| Leverages domain-specific expertise per sub-agent | Multi-level calls increase cost |
44+
| Clean separation of concerns | Harder to debug across agent boundaries |
45+
46+
---
47+
## References
48+
- [[agentic_design_patterns]]
49+
- [[agent_as_tool_pattern]] β€” alternative approach where primary agent retains full control
50+
- [Advanced Agentic Patterns for Multi-Agent Systems](https://youtu.be/89KKm_a4M7A?si=PyQjItG2hIG0Bsn4)

0 commit comments

Comments
Β (0)