Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .claude/skills/llm-wiki-ingest/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ For **every newly created concept page**, generate an infograph card with `/ljg-

**Why this naming matters**: `build_docs.py` looks for `wikis/concepts/assets/{stem}.png` where `{stem}` is the concept page's filename without `.md`. A mismatch means the card won't show up in the docs site.

**For entity pages**: Same rule as concepts — for **every newly created entity page**, generate an infograph card with `/ljg-card -i`. Store in `wikis/entities/assets/{slug}.png`. The same naming convention applies: filename must match the entity page slug. `build_docs.py` uses the same `assets/{stem}.png` lookup for entities.

**For source summaries**: Cards are optional. If generated, store in `wikis/sources/assets/{slug}.png` and embed directly: `![description](assets/filename.png)`.

## Validation — how to know you did it right
Expand Down
20 changes: 20 additions & 0 deletions .claude/skills/llm-wiki-lint/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ Index 不一致意味着导航是骗人的——用户看到的 wiki 地图和

在 log 条目中加:`Card: N missing, M stale`

### 7b. Entity card 完整性检查

与 7a 相同的检查逻辑,但针对 entity 页面。每个 entity 页面应有对应的 infograph card PNG 存放在 `wikis/entities/assets/{slug}.png`。

检查两类问题:

**缺失 card**:entity 页面存在但 `assets/{slug}.png` 不存在。

**card 内容过时**:entity `.md` 比 `.png` 更新。

在 report 中加一节:

```
### Entity Cards (N missing, M stale)
- Missing: `anthropic.md` (no PNG)
- Stale: `openai.md` (md: 2026-04-07, png: 2026-04-01)
```

在 log 条目中加:`Entity Card: N missing, M stale`

### 8. 可读性抽查 — ljg-plain(仅 scope=all 时)

全局 lint 时,从 `wikis/concepts/` 和 `wikis/sources/` 各随机抽 1-2 篇信息密度最高的页面,调用 `/ljg-plain` 做可读性压力测试。
Expand Down
49 changes: 43 additions & 6 deletions .claude/skills/write-mental-model/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,14 @@ Read `.claude/rules/writing-style.md` before each writing session. Key reminders
- **Organic transitions**: No "[上一篇]说X...但Y..." mechanical recaps. Flow like conversation — connect through ideas, not references.
- **Claim rigor**: Every claim classifiable per claim-verification.md. Contested questions pivot to engineering frame.
- **Harness consistency**: "Harness" = entire feedback control system (controller + observer). Plant (LLM) is the only thing NOT part of harness.
- **延伸阅读 (Further Reading)**: No duplicate references across articles. Each reference lives in the article where it's most needed.
- **延伸阅读 (Further Reading)**: This is NOT a source reference list — it is a curated recommendation of 1-3 reads the author genuinely believes are worth the reader's time. Selection criteria (all must be met):
1. **High relevance**: directly extends or deepens the article's core argument, not merely tangentially related
2. **Standalone value**: a reader who follows this link gets a complete, rewarding read — not a landing page, not a 2-paragraph blog post
3. **Non-obvious**: if the reader would find it trivially by searching the article's title, it doesn't belong here — recommend what they'd miss
- Annotate each entry with a 1-sentence reason why it's worth reading (not a summary of the source, but why THIS reader should care)
- No duplicates across articles in the same chapter. Each recommendation lives in the article where it's most needed.
- Cap at 3. If nothing meets all three criteria, it's fine to have 1 or even 0.
- **概念与实体 (Chinese only)**: Every Chinese article (except `index.md`) ends with a `## 概念与实体` section linking to relevant wiki pages. See Step 3a for details.
- **Tail hooks**: Each article ends with a natural hook to the next — a question raised, a tension unresolved, a concept half-introduced.

### Step 3a: Write Chinese articles
Expand All @@ -169,11 +176,40 @@ Write articles in sequence (01 through last). For each article:
- Run the 道-vs-术 test: grep for prescriptive language ("你应该", "最佳实践", "更好的做法是")
- Check cross-references to other articles are correct
- Verify all claims have backing in wiki or references
- Verify 延伸阅读 has at most 3 entries, each with annotation, each meeting all three selection criteria
3. **Micro-review** — After every 2-3 articles, do a quick consistency pass:
- Terminology consistent across articles written so far?
- Transitions organic?
- No duplicate 延伸阅读 entries?

#### 概念与实体 section (Chinese articles only)

Every Chinese article (except `index.md`) ends with a `## 概念与实体` section, placed **after** `## 延伸阅读`. This section links to wiki pages that are directly relevant to the article's content.

**How to populate:**

1. Identify the key concepts and entities discussed in the article
2. Check `wikis/concepts/` and `wikis/entities/` for matching pages (use glob/grep)
3. Select only pages that are **directly relevant** — a concept merely mentioned in passing doesn't qualify; it must be substantively discussed or structurally important to the article's argument
4. Link using relative paths from the article to the wiki: `../../../../../../wikis/concepts/xxx.md` or use the wiki page title as display text

**Format:**

```markdown
## 概念与实体

本文涉及的核心概念与实体,在项目知识库中有更详细的资料:

- [概念名](relative-path-to-wikis/concepts/xxx.md) — 一句话说明与本文的关联
- [实体名](relative-path-to-wikis/entities/yyy.md) — 一句话说明与本文的关联
```

**Rules:**
- Do NOT add this section to `index.md` files
- Do NOT add this section to English articles — this is a Chinese-only feature that leverages our Chinese wiki knowledge base
- Keep it concise: typically 3-6 links. Not a dump of every tangentially related wiki page.
- The annotation explains the relevance to THIS article, not a generic description of the concept

Write the chapter `index.md` after all articles are done — it needs the full picture.

Create `.pages` navigation file for the chapter directory.
Expand Down Expand Up @@ -218,7 +254,7 @@ If the command does not exist, read `references/review-pipeline.md` and execute

1. **Three parallel reviews**:
- **Rules review** (superpowers:code-reviewer) — enforce writing-style.md, claim-verification.md, cross-document concerns
- **Humanizer** (general-purpose agent) — identify AI writing patterns (denial-assertion pairs, rule-of-three abuse, one-sentence dramatic paragraphs, signposting, mirror structures, generic conclusions)
- **Humanizer** (general-purpose agent) — use `/humanizer-zh` for Chinese documents, `/humanizer` for English documents. Identify AI writing patterns per the language-specific skill.
- **Syntax & build review** (superpowers:code-reviewer) — mkdocs-material syntax, admonition indentation, link validity, build pass, CI/CD compatibility

2. **Consolidate** — Single table grouped by severity (Critical > Important > Suggestion), deduplicated
Expand All @@ -235,9 +271,9 @@ After fixes, generate infographics using `ljg-card`:
- `/ljg-card -i` from the chapter's `index.md`
- Embed in `index.md` between intro and article table

**Concept-level visuals** (selective):
- Only when the concept is inherently spatial, structural, or layered
- Present shortlist to user before generating
**Article-level TL;DR cards** (every article):
- Every article gets a card — serves as TL;DR visual for readers and makes articles easy to share
- Design each card independently based on the article's content structure (not from a template)
- Each language designed independently — never copy Chinese layout for English

**For every visual**:
Expand Down Expand Up @@ -332,5 +368,6 @@ These apply throughout all phases:
| Transitions | Organic flow through ideas. No "[上一篇]说X..." recaps. |
| Contested claims | Never take sides on AI philosophy. Pivot to engineering mechanism. |
| Cross-references | Present where needed, links verified, no orphaned mentions. |
| 延伸阅读 | No duplicates across articles. Each lives where most needed. |
| 延伸阅读 | Curated 1-3 recommendations (not a reference list). Each must be highly relevant, standalone value, non-obvious. Annotated with why. No duplicates across chapter. |
| 概念与实体 | Chinese articles only (not index.md). Links to relevant `wikis/concepts/` and `wikis/entities/` pages. 3-6 links, annotated with relevance to the article. |
| INTERNAL_REFERENCES | Never mention internal project names (omne-next, OMNE) in tracked files. |
16 changes: 6 additions & 10 deletions .claude/skills/write-mental-model/references/review-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@ Cross-document concerns to check:

Scan for AI writing patterns. Report only — do not rewrite. For each finding: file, line number, problematic text, pattern name, suggested fix.

Patterns to scan:
- Repetitive sentence structures or formulaic templates
- "这不是X——它是Y" / "This is not X — it is Y" denial-assertion pairs
- Rule-of-three abuse / identical parallel structures
- One-sentence dramatic paragraphs as reveals
- Meta-signposting ("让我们来看...", "Let's explore...")
- Mirror-structure paragraph pairs
- Persuasive authority tropes ("核心在于...", "At its core...")
- Generic positive conclusions ("答案藏在...", "The future looks bright")
- Soulless neutral reporting without personality
**Language-specific skill**: Use the correct humanizer skill based on document language:

- **Chinese documents** (`docs/zh/`): Use `/humanizer-zh`
- **English documents** (`docs/en/`): Use `/humanizer`

If the review scope includes both languages, run the appropriate skill for each file. Do not apply the English humanizer to Chinese text or vice versa.

Tell the humanizer to also read a ch-01 article in the same language as a voice reference.

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
</html>
REDIRECT

- name: Copy llms.txt to site root
run: cp llms.txt _site/llms.txt

- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ test-results/
# MkDocs build output
_site/

# Generated llms.txt (built by scripts/build_docs.py)
/llms.txt

# Quarto rendering artifacts
README_files/

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<p align="center">
<a href="LICENSE-APACHE-2.0"><img src="https://img.shields.io/badge/Code-Apache_2.0-blue.svg" alt="Apache 2.0"></a>
<a href="LICENSE-CC-BY-NC-SA-4.0"><img src="https://img.shields.io/badge/Content-CC_BY--NC--SA_4.0-lightgrey.svg" alt="CC BY-NC-SA 4.0"></a>
<a href="https://panqiwei.github.io/advanced-agentic-dev-patterns/en/"><img src="https://img.shields.io/badge/Docs-Read_Online-blueviolet.svg" alt="Documentation"></a>
</p>

<h4 align="center">
Expand Down
1 change: 1 addition & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<p align="center">
<a href="LICENSE-APACHE-2.0"><img src="https://img.shields.io/badge/代码-Apache_2.0-blue.svg" alt="Apache 2.0"></a>
<a href="LICENSE-CC-BY-NC-SA-4.0"><img src="https://img.shields.io/badge/内容-CC_BY--NC--SA_4.0-lightgrey.svg" alt="CC BY-NC-SA 4.0"></a>
<a href="https://panqiwei.github.io/advanced-agentic-dev-patterns/zh/"><img src="https://img.shields.io/badge/文档-在线阅读-blueviolet.svg" alt="在线文档"></a>
</p>

<h4 align="center">
Expand Down
1 change: 1 addition & 0 deletions docs/en/mental-models/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ nav:
- ch-01-orthogonality
- ch-02-cybernetics
- ch-03-entropy
- ch-04-operating-system
9 changes: 9 additions & 0 deletions docs/en/mental-models/ch-04-operating-system/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Operating System
nav:
- index.md
- 01-from-demon-to-os.md
- 02-memory-hierarchy.md
- 03-scheduling.md
- 04-trust-boundary.md
- 05-cooperation-protocol.md
- 06-where-the-analogy-breaks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# From Demon to OS

<div class="mm-article" data-card="assets/from-demon-to-os.png" data-card-alt="From Demon to OS — institutionalizing the sorting rules" markdown>

Maxwell's Demon works. It reads the partition, classifies each molecule, and operates the trapdoor accordingly. The second law is not violated locally — it is suspended, at the cost of the Demon's continuous presence and judgment. A harness engineer does the same thing: observe the context, filter noise, control what information enters. Structurally, it is the same job.

But the Demon scales to exactly one door.

One Demon, one judgment at a time. No rules, no fallback when it is absent, no audit trail when it makes a mistake. This is not an implementation problem — it is the structural ceiling of the case-by-case judgment pattern. You cannot have one Demon per tool call.

Write the sorting rules down as policy, and you have an operating system.

## Karpathy's three-year refinement

In 2023, Andrej Karpathy described LLMs as "the kernel process of an emerging operating system." The phrase stuck. It captured something intuitively right about the relationship between language models and the broader computational infrastructure forming around them.

Three years later, he made the intuition precise. In a 2026 exchange on X:

!!! quote "Karpathy, March 2026"

LLM = CPU (dynamics: statistical and vague not deterministic and precise)
Agent = OS kernel (the "smartest" process managing resources and coordinating other processes)
Harness = OS (the full system with all its components, policies, abstractions)

The 2026 version does not invalidate the 2023 intuition — it resolves it into structure. The 2023 observation was holistic: something OS-like is emerging around LLMs. The 2026 version decomposes that intuition into three distinct layers with distinct roles.

The decomposition matters because it changes what you look for. Once you see the three layers separately, the questions become specific: what does memory management look like when RAM is a context window? What does scheduling look like when a CPU call costs money? What does a trust boundary look like when the CPU itself can be "persuaded" by language?

## The three-layer mapping

| OS Layer | Agent System | Core Property |
|:---------|:------------|:--------------|
| CPU | LLM | Statistical and vague, not deterministic and precise |
| OS kernel | Agent | Manages resources, coordinates processes |
| Full OS | Harness | All components, policies, abstractions |

The architectural relationship is preserved across the mapping. The CPU executes instructions; it does not decide what to execute. The kernel orchestrates resources, schedules processes, enforces boundaries — it is the decision layer above the execution layer. The full OS wraps everything: memory subsystems, scheduling algorithms, permission models, inter-process communication, all the accumulated engineering that makes the hardware usable.

An LLM executes tokens. It does not decide what task to work on, which tools to call, when to stop, or how to allocate a budget. An agent — specifically the orchestrating logic — does that coordination. The harness is the full system: context management, task scheduling, trust enforcement, collaboration protocols.

The analogy is not decorative. OS engineers spent fifty years solving problems that agent engineers are encountering now, in slightly different shapes. Every design intuition buried in OS architecture — why preemptive scheduling beats cooperative, why virtual memory beats manual allocation, why least-privilege is worth its complexity — came from painful failures. That accumulated intuition does not need to be re-earned from scratch.

## Where "statistical and vague" changes everything

Karpathy's one-sentence CPU definition does something subtle. It does not just say "LLM is like a CPU." It specifies the exact dimension where the analogy holds and exactly where it breaks. The dynamics are statistical and vague, not deterministic and precise.

An OS kernel trusts its CPU implicitly. The CPU executes whatever instruction sequence it receives. It does not understand the instructions. It cannot be convinced to ignore a segment fault or escalate privileges through a well-crafted argument. The hardware barrier between user mode and kernel mode is enforced by the physics of the chip, not by the CPU's willingness to cooperate.

An agent's CPU is different. The LLM is the system that reads all inputs — including inputs that might be deliberately crafted to alter its behavior. There is no type system, no instruction validator, no hardware mechanism that distinguishes instructions from data. Natural language is the interface, and natural language has no equivalent to a segment fault. This single property cascades into every design decision: memory management cannot just track what is present, it must track what is accurate. Scheduling cannot just detect process termination, it must judge semantic completion. Trust boundaries cannot rely on hardware enforcement, they must be layered architecturally.

Five OS abstractions, each worth fifty years of refinement, each needing adaptation for a probabilistic CPU — and each breaking at a precise point that reveals something the OS never had to solve.

---

The most immediate constraint in any agent system is also the most visible: the context window. Everything the LLM "knows" at inference time has to fit there. How OS engineers solved the analogous problem — infinite logical memory from finite physical memory — is where the story begins.

</div>

---

## Further reading

- Karpathy, A. (2023). Intro to Large Language Models. YouTube. ("the kernel process of an emerging operating system")
- Karpathy, A. (2026-03-31). Reply to @gvanrossum. X. (The three-layer decomposition: LLM=CPU, Agent=kernel, Harness=OS)
Loading
Loading