Skip to content

refactor(book): unify the two competing security taxonomies into one three-layer skeleton - #860

Merged
bojieli merged 17 commits into
mainfrom
book/unify-security-taxonomy
Aug 15, 2026
Merged

refactor(book): unify the two competing security taxonomies into one three-layer skeleton#860
bojieli merged 17 commits into
mainfrom
book/unify-security-taxonomy

Conversation

@bojieli

@bojieli bojieli commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Implements item 7 of the structural review: "安全有两套互不相认的分类法".

Stacked on #859. Once #859 merges, this PR retargets to main cleanly.

The problem

The book carried two rival ways of classifying defenses:

  • Chapter 1 sorted guardrails by position in the request lifecycle: input side / execution side / output side.
  • Chapters 2 and 5 sorted them by where the trust boundary is enforced: context layer / execution layer / data layer.

The giveaway: Chapter 2 already said "this confirms the layered-defense principle from Chapter 1" and used the context/execution vocabulary — a principle Chapter 1 never actually stated.

The fix

Adopt the second taxonomy book-wide and front it in Chapter 1.

Chapter 1's "Types of Guardrails" is rewritten around context layer / execution layer / data layer, ordered not by lifecycle position but by how hard each layer is to bypass. All existing material is preserved and reassigned:

Was Now
Input-side (relevance / safety classifier, moderation, rule-based) Context layer — what the model gets to see
Execution-side (tool risk rating) Execution layer — what the model gets to do
Output-side (PII filter, output validation) Execution layer — a reply to the user is itself an action (Chapter 4 classifies it as a user-communication tool)
Data layer — what the world can ultimately be changed into

Two substantive additions:

  • The context layer's structural ceiling: an Agent sitting inside the attacked context can hardly tell whether it has already been injected, so this layer lowers success rates but cannot give a guarantee. That is the argument for the two layers below it.
  • The data layer, which holds even when the layers above it fail — even if the injection succeeds and the generated code omits its permission checks entirely.

Hanging the rest of the book on the same tree:

  • Chapter 1's forward pointers now name the layer each chapter develops; the chapter summary states the skeleton instead of an unrelated "five levels" list.
  • Chapter 4: the MCP-poisoning mitigations are split across the context layer (auditing tool descriptions) and the execution layer (least-privilege credentials); the stray "execution side" wording is aligned to "execution layer".
  • Chapter 5: the Coding Agent defense narrative and the "move the trust boundary down to the data layer" argument are named as layers of the Chapter 1 skeleton.
  • Chapter 9: the self-evolution safety gate is tied to the same reasoning — a real guarantee must come from a layer the modifier cannot reach.

Scope

Applied to the Chinese edition and all 12 translations in one PR, so no edition is left with the old taxonomy.

Verified: experiment, figure and thought-question inventories still match the Chinese across all 13 editions; no dangling footnotes, missing images, or unbalanced code fences.

🤖 Generated with Claude Code

bojieli and others added 16 commits August 13, 2026 11:15
The Chinese source had reader-visible figure numbering gaps left behind by
earlier content removals, and the caption number no longer matched the
filename in two chapters.

- ch5: restore the 图5-4 embed dropped by d39b1d7 while its prose reference
  survived, closing the 5-3 -> 5-5 gap.
- ch7: retire the two figures the chapter dropped to descriptive names and
  shift fig7-18/19/20 down so caption number == filename again.
- ch10: renumber 10-3..10-13 to 10-2..10-11 across all 13 editions, closing
  the gaps at 10-2 and 10-10; retire the two removed figures to descriptive
  names. Drop the dangling "Figure 10-10" reference in the English edition.
- Rebuild fig8-1 for the 11 editions still shipping the pre-04c0ed70 artwork.

The Chinese source now has gapless, filename-aligned numbering in every
chapter with no dangling cross-references.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Commit 04c0ed7 replaced all five Chinese chapter-8 figures when the chapter
was reorganized around continual evolution. Only book-ko, added afterwards,
picked them up; every other edition still shipped the pre-reorganization
artwork, so the captions described the new chapter while the pictures showed
the old one. In book-en, book-ar and book-zhtw fig8-3 was additionally still
untranslated Simplified Chinese, and book-es/ja/tr carried a further two-figure
offset whose fig8-3/fig8-4 showed chapter-4 material.

Rebuilds fig8-1..fig8-5 for all 11 affected editions from the current Chinese
geometry, translating text nodes only so the drawings stay identical, and
drops the orphaned fig8-6/fig8-7 left in book-es, book-ja and book-tr.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Eight editions still carried chapter-3 figures from an earlier revision, two
of which showed the wrong drawing entirely:

- fig3-2 ("four memory strategies") rendered the RAG query flow, i.e. the
  artwork belonging to fig3-5.
- fig3-4 ("multi-type memory architecture") rendered the HNSW index structure
  from fig3-7.
- fig3-1 showed the retired RAG-fundamentals map instead of the chapter
  knowledge map (fixed for book-en in #816, never carried across).
- fig3-11 showed the retired GraphRAG walkthrough built on the x86 SSE/AVX
  instruction set -- a CPU diagram in a knowledge-graph section. In book-hu it
  instead showed fig3-14's contextual retrieval.
- fig3-12 was an earlier revision of the agentic vs. non-agentic comparison.

All five are regenerated for ar, es, hu, id, ja, ru, ta and tr from the current
book-en geometry, translating text nodes only, so every edition now matches the
Chinese drawing exactly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every edition captioned fig9-7 as "9-6", duplicating the number already used
by fig9-6, so all later captions ran one behind their file and the chapter
ended with fig9-12 labelled 9-11. Captions are now renumbered to match their
filenames, and the fig9-11/fig9-12 embeds (VLA, Sim2Real) are dropped to match
the Chinese chapter, which removed them in #730. The files stay on disk; the
course slides link fig9-11 directly.

Also rebuilds fig4-9 from the Chinese for the six editions that shipped it
untranslated or, in book-es and book-tr, showing a duplicate of fig4-8, and
switches book-hu to the shared fig2-7.png attention heat map that the other
twelve editions use.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every edition captioned fig9-7 as "9-6", duplicating the number already used by
fig9-6, so each later caption ran one behind its file and the chapter ended with
fig9-12 labelled 9-11. Captions now match their filenames in all twelve
editions; the figure set itself is unchanged, so the prose cross-references
still resolve.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The chapter 10 renumber matched captions on the "Рис." prefix and missed the
one caption written as "Рисунок 10-11", leaving it pointing at fig10-9.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ering

Chapter 9's numbering gaps at 9-5/9-6 were a prose problem, not a figure
problem: eight editions had condensed the "cognitive timing" section into a
single summary paragraph, so the fast/slow-thinking and Step-Audio R1 figures
had nowhere to attach. Their SVGs were already present and correctly
translated -- just never referenced.

- Restore the three #### subsections the Chinese has (fast thinking answers /
  fast thinking interacts / end-to-end unification) in ar, es, hu, id, ru, ta,
  tr and vi, translated to match each edition's existing terminology, and
  re-attach fig9-5 and fig9-6.
- Drop the fig9-11/fig9-12 embeds and their in-text references in all twelve
  editions: #730 deliberately removed both from the Chinese chapter, and the
  Chinese is authoritative. The VLA and Sim2Real prose stays.
- book-hu: move the fig7-7 experiment box back ahead of the pre-training
  section and the fig10-9 MetaGPT section after fig10-8, matching the Chinese
  reading order.

Chapter 9 is now exactly ten figures in all thirteen editions, and every
chapter of every edition is gapless, caption-aligned and in order.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…w, ja, es, ru, tr)

Commit 05ab7f3 condensed the Chinese reward-design section into four
subsections; the translations still carried the superseded version, roughly ten
times longer and organised differently, along with fig7-16 and fig7-17 which
the Chinese no longer has.

Replaces the three old reward subsections with a translation of the current
Chinese four-subsection structure and adds the [^ch7-23] and [^ch7-29]
footnotes, which existed only in the Chinese.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Commit 05ab7f3 condensed the Chinese reward-design section from three loosely
organised subsections into four sharper ones and dropped two figures. The
translations never followed, so every edition still shipped the superseded
version -- roughly ten times longer than the Chinese and structured
differently -- along with fig7-16 and fig7-17, which no longer exist upstream.

- Replace the old reward subsections in ar, en, es, hu, id, ja, ko, ru, ta,
  tr, vi and zhtw with a translation of the current Chinese four-subsection
  structure, matching each edition's established terminology.
- Add the [^ch7-23] and [^ch7-29] footnotes, previously Chinese-only.
- Retire fig7-16/fig7-17 to descriptive names and shift fig7-18/19/20 down, so
  chapter 7 is 18 figures with caption number == filename in every edition,
  exactly as the Chinese source now is.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fig4-7 and fig4-8 shipped with untranslated Chinese labels in book-en, book-ar,
book-ta and book-vi; the Arabic copies were additionally part-machine-translated
into garbled mixtures. Both are rebuilt from the Chinese geometry with proper
translations, keeping tool identifiers and protocol role names as-is. Also
translates the one English sentence left in book-ta's fig9-4.

The Chinese text remaining in fig2-6 and fig10-5 is deliberate: it is the
example sentence being analysed and the glossary data the figure illustrates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…n/numbering-alignment

# Conflicts:
#	book-ar/chapter7.ar.md
#	book-ar/chapter9.ar.md
#	book-en/chapter7.md
#	book-en/chapter9.md
#	book-es/chapter7.es.md
#	book-es/chapter9.es.md
#	book-hu/chapter10.md
#	book-hu/chapter7.md
#	book-hu/chapter9.md
#	book-id/chapter7.md
#	book-id/chapter9.md
#	book-ja/chapter7.ja.md
#	book-ja/chapter9.ja.md
#	book-ko/chapter7.ko.md
#	book-ko/chapter9.ko.md
#	book-ru/chapter7.md
#	book-ru/chapter9.md
#	book-ta/chapter7.ta.md
#	book-ta/chapter9.ta.md
#	book-tr/chapter7.tr.md
#	book-tr/chapter9.tr.md
#	book-vi/chapter7.vi.md
#	book-vi/chapter9.vi.md
#	book-zhtw/chapter7.zhtw.md
#	book-zhtw/chapter9.zhtw.md
#	book/chapter10.md
#	book/chapter7.md
#	book/images/fig8-17.svg
#	book/images/fig8-18.svg
#	slides/public/images/fig10-13.svg
…nslations

Bring the numbering skeleton of every translated edition into line with the
Chinese edition, so that later structural work can be applied mechanically.
The Chinese edition is the source of truth throughout.

Experiments
- ch2: add the missing 实验 2-7 (writing Skill from personal samples) to all
  12 editions and shift the following experiments 2-7..2-9 → 2-8..2-10;
  rename the accompanying footnote ch2-7 → ch2-8 to match.
- ch4: add the missing multimodal-extraction experiment as 4-2 to 10 editions
  and shift 4-2..4-6 → 4-3..4-7. book-en had this experiment mislabelled as
  "Experiment 3-7" (colliding with a real 3-7 in chapter 3) and placed before
  4-1; it is relabelled 4-2 and moved after the 4-1 box. Chapter summaries
  that enumerate the experiments are updated (six → seven, ranges corrected).
- ch5: book-hu had the production-log experiment mislabelled 5-5 (duplicating
  the real 5-5) and was missing 5-7 entirely; the box is renumbered 5-8 and a
  translation of 实验 5-7 (adaptive log parser) is added.
- ch7: add the missing 7-12 (V-IRL-VL) and 7-13 (SimpleVLA-RL) boxes to all
  12 editions, together with the [^ch7-24] footnote they cite. Also fix the
  stale in-text numbers: ReTool was cited as 7-15 (it is 7-14) and RLVP as
  7-14 (it is 7-16).

Figures
- ch9: 8 editions compressed the fast/slow-thinking section into a single
  paragraph and therefore lost 图9-5 and 图9-6. The three-solution block is
  translated in full so all editions carry the same figure inventory.

Tables
- ch6: remove the translation-only Pass@k/Pass^k table (no counterpart in the
  Chinese) and renumber 6-4..6-6 → 6-3..6-5. In book-en this table also
  duplicated the number of the memory-system table.
- ch10: remove the translation-only shared/non-shared selection-criteria table
  and renumber 10-2..10-4 → 10-1..10-3.
- ch9: add the 表9-1 caption to the MiniCPM-o experiment in 11 editions.
- book-id ch3: translate the untranslated "Table 3-3" caption.
- book-ar ch7: fix the transposed table number 1-7 → 7-1.

Other consistency fixes
- book-hu: 542 headings and labels across all chapters had their bold markers
  replaced by straight double quotes, which hid whole experiment boxes from
  the numbering. Restored (code blocks left untouched; the edition uses
  „…" for real quotations).
- book-hu ch10: move the 10-4 experiment box back into the manager-pattern
  section so 图10-8 precedes 图10-9.
- book-ar ch2: drop an Arabic-only passage (and its [^ch2-5] footnote) that
  has no counterpart in the Chinese.
- book-ru ch2: add the missing [^lost-in-the-middle] footnote.
- book-vi ch1: Thử nghiệm 1.2 → 1-2.

After this change the only remaining gap is book-ar/chapter4, which is
covered by the separate chapter-4 retranslation PR.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Picks up the Arabic chapter 4 retranslation (#857), which closes the one
gap the numbering audit had left open.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…2 translations

Mirror the Chinese restructure (#856) in every translated edition, so that all
13 editions share one chapter layout, numbering scheme and file naming.

Structure
- New Chapter 6 "Interaction: Expanding the Observation and Action Spaces",
  assembled from a newly written framing section, the event-driven async block
  lifted out of Chapter 4, and the whole of the old Chapter 9 (voice, Computer
  Use, robotics), followed by a merged summary and 12 merged exercises.
- Old chapters 6/7/8 shift to 7/8/9; the old chapter 9 file is consumed by the
  new chapter 6. Chapter 4 keeps the three Agent-invoked tool categories and
  hands the event-triggered and user-communication tools to Chapter 6.

Mechanical parts, applied per edition with language-specific label patterns
- Cross-chapter references rotate 6→7→8→9→6 (including Arabic ordinal words
  and Traditional Chinese numerals).
- Figures, experiments, tables and footnote IDs renumbered with one global map:
  fig4-2..4-6 → fig6-1..6-5, fig9-N → fig6-(N+5), fig4-7..4-9 → fig4-2..4-4,
  and 6→7, 7→8, 8→9 for the shifted chapters; 56 SVGs renamed per edition.
- Companion code links (`../chapterN/`) rotate with the code directories.

New prose written for every edition
- Chapter title, opening, the "Two Axes: Modality and Timing" section with both
  tables, the async section heading and its lead-in, the chapter summary, and
  the twelfth exercise plus its reference answer.
- Chapter 4's roadmap paragraph, tool-classification paragraph and summary are
  rewritten to hand off the two event-driven tool categories.
- introduction and afterword: the part structure becomes 2–6 / 7–9 / 10, the
  chapter-6 bullet is rewritten and moved into place, the old multimodal bullet
  is retired, and the reading paths and prerequisite chapter numbers follow.
- reference-answers: Chapter 4 drops to four answers, the three that moved plus
  the eight from the old chapter 9 and one new answer form the chapter 6
  section, which is repositioned accordingly.

Also fixes seven stale companion links in the Chinese edition that #856 left
pointing at the pre-rotation directories.

Verified: for all 12 editions × 10 chapters, the experiment inventory, figure
inventory and order, and thought-question count match the Chinese exactly; no
dangling footnotes, no missing image files, no unbalanced code fences.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
main squash-merged #858, whose content this branch already contains; the tree
is kept as-is so only the Chapter 6 restructure remains as the diff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…three-layer skeleton

The book carried two rival ways of classifying defenses. Chapter 1 sorted
guardrails by position in the request lifecycle (input side / execution side /
output side); chapters 2 and 5 sorted them by where the trust boundary is
enforced (context layer / execution layer / data layer). Chapter 2 already
said "this confirms the layered-defense principle from Chapter 1" and used the
context/execution vocabulary — a principle Chapter 1 did not actually state.

Adopt the second taxonomy book-wide and front it in Chapter 1:

- Chapter 1's "Types of Guardrails" is rewritten around **context layer /
  execution layer / data layer**, ordered not by lifecycle position but by how
  hard each layer is to bypass. The existing material is preserved and
  reassigned: the four input-side mechanisms become the context layer; tool
  risk rating stays at the execution layer; output checks join it, since a
  reply to the user is itself an action (Chapter 4 classifies it as a
  user-communication tool). Two points are added — the context layer's
  structural ceiling (an Agent inside the attacked context can hardly tell it
  has been injected, so this layer lowers success rates but gives no
  guarantee), and the data layer, which holds even when the layers above it
  fail.
- Chapter 1's pointers now name the layer each chapter develops, and its
  summary states the skeleton instead of an unrelated five-level list.
- Chapters 4, 5 and 9 are hung on the same tree: the MCP mitigations are split
  across the context and execution layers, the Coding Agent defense narrative
  and the "move the trust boundary down to the data layer" argument are named
  as layers of the Chapter 1 skeleton, and the self-evolution safety gate is
  tied to the same reasoning — a real guarantee must come from a layer the
  modifier cannot reach. The stray "execution side" wording in Chapter 4 is
  aligned to "execution layer".

Applied to the Chinese edition and all 12 translations. Verified that the
experiment, figure and thought-question inventories still match the Chinese
across all 13 editions, with no dangling footnotes, missing images or
unbalanced code fences.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bojieli
bojieli changed the base branch from i18n/chapter6-restructure to main August 15, 2026 10:26
main squash-merged #859, whose content this branch already contains; the tree
is kept as-is so only the security-taxonomy change remains as the diff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant