folio-kb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. folio_kb-0.1.0/.gitignore +7 -0
  2. folio_kb-0.1.0/CHANGELOG.md +13 -0
  3. folio_kb-0.1.0/LICENSE +21 -0
  4. folio_kb-0.1.0/PKG-INFO +110 -0
  5. folio_kb-0.1.0/README.md +93 -0
  6. folio_kb-0.1.0/craft/README.md +10 -0
  7. folio_kb-0.1.0/craft/diagrams.md +43 -0
  8. folio_kb-0.1.0/craft/figures.md +38 -0
  9. folio_kb-0.1.0/craft/layout.md +32 -0
  10. folio_kb-0.1.0/craft/tables.md +34 -0
  11. folio_kb-0.1.0/genres/concept/GENRE.md +78 -0
  12. folio_kb-0.1.0/genres/concept/skeleton.html +38 -0
  13. folio_kb-0.1.0/genres/entry/GENRE.md +75 -0
  14. folio_kb-0.1.0/genres/entry/skeleton.html +29 -0
  15. folio_kb-0.1.0/genres/guide/GENRE.md +88 -0
  16. folio_kb-0.1.0/genres/guide/skeleton-chapter.html +27 -0
  17. folio_kb-0.1.0/genres/guide/skeleton.html +22 -0
  18. folio_kb-0.1.0/genres/journal/GENRE.md +83 -0
  19. folio_kb-0.1.0/genres/journal/skeleton.md +11 -0
  20. folio_kb-0.1.0/genres/map/GENRE.md +76 -0
  21. folio_kb-0.1.0/genres/map/skeleton.html +32 -0
  22. folio_kb-0.1.0/genres/note/GENRE.md +68 -0
  23. folio_kb-0.1.0/genres/note/skeleton.html +21 -0
  24. folio_kb-0.1.0/genres/paper/GENRE.md +100 -0
  25. folio_kb-0.1.0/genres/paper/skeleton-landing.html +21 -0
  26. folio_kb-0.1.0/genres/paper/skeleton.tex +42 -0
  27. folio_kb-0.1.0/genres/project/GENRE.md +78 -0
  28. folio_kb-0.1.0/genres/project/skeleton.html +37 -0
  29. folio_kb-0.1.0/packs/knowledge-base/PACK.md +42 -0
  30. folio_kb-0.1.0/packs/knowledge-base/genres/reading/GENRE.md +86 -0
  31. folio_kb-0.1.0/packs/knowledge-base/genres/reading/skeleton.html +44 -0
  32. folio_kb-0.1.0/packs/knowledge-base/genres/source/GENRE.md +92 -0
  33. folio_kb-0.1.0/packs/knowledge-base/genres/source/skeleton.html +33 -0
  34. folio_kb-0.1.0/packs/knowledge-base/genres/survey/GENRE.md +88 -0
  35. folio_kb-0.1.0/packs/knowledge-base/genres/survey/skeleton.html +46 -0
  36. folio_kb-0.1.0/packs/knowledge-base/rules.md +20 -0
  37. folio_kb-0.1.0/packs/knowledge-base/workflows/ingest.md +43 -0
  38. folio_kb-0.1.0/packs/knowledge-base/workflows/quiz.md +44 -0
  39. folio_kb-0.1.0/packs/lab/PACK.md +57 -0
  40. folio_kb-0.1.0/packs/lab/genres/claim/GENRE.md +100 -0
  41. folio_kb-0.1.0/packs/lab/genres/claim/skeleton.md +24 -0
  42. folio_kb-0.1.0/packs/lab/genres/protocol/GENRE.md +155 -0
  43. folio_kb-0.1.0/packs/lab/genres/protocol/skeleton.md +51 -0
  44. folio_kb-0.1.0/packs/lab/genres/question/GENRE.md +96 -0
  45. folio_kb-0.1.0/packs/lab/genres/question/skeleton.md +22 -0
  46. folio_kb-0.1.0/packs/lab/genres/report/GENRE.md +91 -0
  47. folio_kb-0.1.0/packs/lab/genres/report/skeleton.html +42 -0
  48. folio_kb-0.1.0/packs/lab/genres/result/GENRE.md +106 -0
  49. folio_kb-0.1.0/packs/lab/genres/result/skeleton.md +18 -0
  50. folio_kb-0.1.0/packs/lab/rules.md +33 -0
  51. folio_kb-0.1.0/packs/lab/workflows/record-a-result.md +58 -0
  52. folio_kb-0.1.0/packs/lab/workflows/write-a-report.md +59 -0
  53. folio_kb-0.1.0/pyproject.toml +64 -0
  54. folio_kb-0.1.0/shell/COMPONENTS.md +140 -0
  55. folio_kb-0.1.0/shell/folio.css +673 -0
  56. folio_kb-0.1.0/shell/folio.js +1391 -0
  57. folio_kb-0.1.0/skills/address/SKILL.md +75 -0
  58. folio_kb-0.1.0/skills/configure/SKILL.md +88 -0
  59. folio_kb-0.1.0/skills/organise/SKILL.md +92 -0
  60. folio_kb-0.1.0/skills/publish/SKILL.md +70 -0
  61. folio_kb-0.1.0/skills/run/SKILL.md +69 -0
  62. folio_kb-0.1.0/skills/set-up/SKILL.md +72 -0
  63. folio_kb-0.1.0/skills/write/SKILL.md +111 -0
  64. folio_kb-0.1.0/src/folio/__init__.py +3 -0
  65. folio_kb-0.1.0/src/folio/__main__.py +5 -0
  66. folio_kb-0.1.0/src/folio/annotations.py +231 -0
  67. folio_kb-0.1.0/src/folio/charter.py +361 -0
  68. folio_kb-0.1.0/src/folio/checks/__init__.py +1 -0
  69. folio_kb-0.1.0/src/folio/checks/card.py +366 -0
  70. folio_kb-0.1.0/src/folio/checks/gate.py +293 -0
  71. folio_kb-0.1.0/src/folio/checks/later.py +54 -0
  72. folio_kb-0.1.0/src/folio/checks/lifecycle.py +203 -0
  73. folio_kb-0.1.0/src/folio/checks/problems.py +17 -0
  74. folio_kb-0.1.0/src/folio/checks/registry.py +61 -0
  75. folio_kb-0.1.0/src/folio/checks/rules.py +327 -0
  76. folio_kb-0.1.0/src/folio/checks/run.py +52 -0
  77. folio_kb-0.1.0/src/folio/cli.py +439 -0
  78. folio_kb-0.1.0/src/folio/commands/__init__.py +1 -0
  79. folio_kb-0.1.0/src/folio/commands/annotate.py +114 -0
  80. folio_kb-0.1.0/src/folio/commands/charter_cmds.py +86 -0
  81. folio_kb-0.1.0/src/folio/commands/create.py +234 -0
  82. folio_kb-0.1.0/src/folio/commands/genre_cmds.py +214 -0
  83. folio_kb-0.1.0/src/folio/commands/graph_cli.py +180 -0
  84. folio_kb-0.1.0/src/folio/commands/lookup.py +97 -0
  85. folio_kb-0.1.0/src/folio/commands/maps_cmds.py +254 -0
  86. folio_kb-0.1.0/src/folio/commands/move.py +334 -0
  87. folio_kb-0.1.0/src/folio/commands/pack_add.py +113 -0
  88. folio_kb-0.1.0/src/folio/commands/query.py +49 -0
  89. folio_kb-0.1.0/src/folio/commands/setup.py +125 -0
  90. folio_kb-0.1.0/src/folio/commands/tags_cmds.py +49 -0
  91. folio_kb-0.1.0/src/folio/data.py +32 -0
  92. folio_kb-0.1.0/src/folio/documents.py +266 -0
  93. folio_kb-0.1.0/src/folio/edits.py +216 -0
  94. folio_kb-0.1.0/src/folio/errors.py +2 -0
  95. folio_kb-0.1.0/src/folio/frontmatter.py +70 -0
  96. folio_kb-0.1.0/src/folio/genres.py +387 -0
  97. folio_kb-0.1.0/src/folio/history.py +128 -0
  98. folio_kb-0.1.0/src/folio/html.py +166 -0
  99. folio_kb-0.1.0/src/folio/indexer.py +324 -0
  100. folio_kb-0.1.0/src/folio/latex/folio.sty +30 -0
  101. folio_kb-0.1.0/src/folio/library.py +165 -0
  102. folio_kb-0.1.0/src/folio/links.py +167 -0
  103. folio_kb-0.1.0/src/folio/metaedit.py +65 -0
  104. folio_kb-0.1.0/src/folio/packs.py +100 -0
  105. folio_kb-0.1.0/src/folio/paper.py +200 -0
  106. folio_kb-0.1.0/src/folio/paths.py +53 -0
  107. folio_kb-0.1.0/src/folio/redirects.py +77 -0
  108. folio_kb-0.1.0/src/folio/regions.py +63 -0
  109. folio_kb-0.1.0/src/folio/site/__init__.py +1 -0
  110. folio_kb-0.1.0/src/folio/site/dates.py +37 -0
  111. folio_kb-0.1.0/src/folio/site/identity.py +101 -0
  112. folio_kb-0.1.0/src/folio/site/notes.py +117 -0
  113. folio_kb-0.1.0/src/folio/site/record.py +124 -0
  114. folio_kb-0.1.0/src/folio/site/render.py +149 -0
  115. folio_kb-0.1.0/src/folio/site/review.py +224 -0
  116. folio_kb-0.1.0/src/folio/site/serve.py +213 -0
  117. folio_kb-0.1.0/src/folio/site/site.py +269 -0
  118. folio_kb-0.1.0/src/folio/util.py +80 -0
  119. folio_kb-0.1.0/tests/conftest.py +47 -0
  120. folio_kb-0.1.0/tests/fixtures/sample/.folio/backlinks.json +367 -0
  121. folio_kb-0.1.0/tests/fixtures/sample/.folio/cards.json +22 -0
  122. folio_kb-0.1.0/tests/fixtures/sample/.folio/catalog.json +520 -0
  123. folio_kb-0.1.0/tests/fixtures/sample/.folio/journal.json +44 -0
  124. folio_kb-0.1.0/tests/fixtures/sample/.folio/nav.json +27 -0
  125. folio_kb-0.1.0/tests/fixtures/sample/.folio/redirects.json +5 -0
  126. folio_kb-0.1.0/tests/fixtures/sample/.folio/search.json +329 -0
  127. folio_kb-0.1.0/tests/fixtures/sample/assets/data/pi-errors.csv +3 -0
  128. folio_kb-0.1.0/tests/fixtures/sample/assets/figures/attention-tiling.pdf +0 -0
  129. folio_kb-0.1.0/tests/fixtures/sample/assets/refs.bib +6 -0
  130. folio_kb-0.1.0/tests/fixtures/sample/content/claims/C-1.md +24 -0
  131. folio_kb-0.1.0/tests/fixtures/sample/content/concepts/self-attention/index.html +22 -0
  132. folio_kb-0.1.0/tests/fixtures/sample/content/concepts/softmax/index.html +25 -0
  133. folio_kb-0.1.0/tests/fixtures/sample/content/entries/attention-is-quadratic/index.html +24 -0
  134. folio_kb-0.1.0/tests/fixtures/sample/content/guides/attention-from-scratch/01-scores.html +21 -0
  135. folio_kb-0.1.0/tests/fixtures/sample/content/guides/attention-from-scratch/02-softmax.html +21 -0
  136. folio_kb-0.1.0/tests/fixtures/sample/content/guides/attention-from-scratch/index.html +20 -0
  137. folio_kb-0.1.0/tests/fixtures/sample/content/index.html +20 -0
  138. folio_kb-0.1.0/tests/fixtures/sample/content/journal/2026/2026-10-01-set-up-the-library.md +11 -0
  139. folio_kb-0.1.0/tests/fixtures/sample/content/journal/2026/2026-10-02-lab-meeting.md +10 -0
  140. folio_kb-0.1.0/tests/fixtures/sample/content/journal/2026/2026-10-02-recorded-r-4.md +10 -0
  141. folio_kb-0.1.0/tests/fixtures/sample/content/maps/attention.html +33 -0
  142. folio_kb-0.1.0/tests/fixtures/sample/content/maps/lab-work.html +23 -0
  143. folio_kb-0.1.0/tests/fixtures/sample/content/notes/flashattention-tiling.html +19 -0
  144. folio_kb-0.1.0/tests/fixtures/sample/content/papers/tiled-attention/index.html +19 -0
  145. folio_kb-0.1.0/tests/fixtures/sample/content/papers/tiled-attention/main.tex +23 -0
  146. folio_kb-0.1.0/tests/fixtures/sample/content/projects/attention-kernel/index.html +22 -0
  147. folio_kb-0.1.0/tests/fixtures/sample/content/protocols/pi-error-scaling.md +51 -0
  148. folio_kb-0.1.0/tests/fixtures/sample/content/questions/Q-1.md +25 -0
  149. folio_kb-0.1.0/tests/fixtures/sample/content/readings/2017-attention-is-all-you-need-reading.html +27 -0
  150. folio_kb-0.1.0/tests/fixtures/sample/content/reports/pi-error-scaling-report/index.html +28 -0
  151. folio_kb-0.1.0/tests/fixtures/sample/content/results/R-3.md +17 -0
  152. folio_kb-0.1.0/tests/fixtures/sample/content/results/R-4.md +19 -0
  153. folio_kb-0.1.0/tests/fixtures/sample/content/sources/2017-attention-is-all-you-need/index.html +28 -0
  154. folio_kb-0.1.0/tests/fixtures/sample/content/sources/2017-attention-is-all-you-need/original.pdf +1 -0
  155. folio_kb-0.1.0/tests/fixtures/sample/content/sources/2022-flashattention/index.html +27 -0
  156. folio_kb-0.1.0/tests/fixtures/sample/content/surveys/exact-attention.html +33 -0
  157. folio_kb-0.1.0/tests/fixtures/sample/folio.yaml +11 -0
  158. folio_kb-0.1.0/tests/test_annotations.py +88 -0
  159. folio_kb-0.1.0/tests/test_checks.py +301 -0
  160. folio_kb-0.1.0/tests/test_cli.py +72 -0
  161. folio_kb-0.1.0/tests/test_comments.py +353 -0
  162. folio_kb-0.1.0/tests/test_docs_commands.py +47 -0
  163. folio_kb-0.1.0/tests/test_end_to_end.py +152 -0
  164. folio_kb-0.1.0/tests/test_fixes.py +198 -0
  165. folio_kb-0.1.0/tests/test_fixes2.py +296 -0
  166. folio_kb-0.1.0/tests/test_focus.py +72 -0
  167. folio_kb-0.1.0/tests/test_genres.py +93 -0
  168. folio_kb-0.1.0/tests/test_graph.py +350 -0
  169. folio_kb-0.1.0/tests/test_history.py +136 -0
  170. folio_kb-0.1.0/tests/test_paper.py +149 -0
  171. folio_kb-0.1.0/tests/test_rules.py +131 -0
  172. folio_kb-0.1.0/tests/test_sample.py +60 -0
  173. folio_kb-0.1.0/tests/test_site.py +180 -0
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .pytest_cache/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ _site/
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-04)
4
+
5
+ The first release.
6
+
7
+ - The `folio` command: create a library, write documents from genre skeletons, keep maps, the journal and comment threads, move and retire documents with links kept, search, serve and export a static site, and build and freeze papers.
8
+ - The gate, `folio check`: links, genre cards, fields, placeholders, lifecycles checked against git, orphans, unique ids, current indices and stale quotes, with severities set in the charter.
9
+ - Eight core genres: concept, note, entry, map, guide, project, journal, paper.
10
+ - Two packs: knowledge-base (source, reading, survey; ingest and quiz) and lab (question, protocol, result, claim, report; record-a-result and write-a-report).
11
+ - Seven skills: set-up, configure, write, organise, address, publish, run.
12
+ - The shell: one stylesheet and one script for every page, in light and dark, with the library rail and a focus on one or more topics.
13
+ - The documentation in `docs/`, itself a folio library, and the specification in `docs/spec/`.
folio_kb-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Piergiuseppe Mallozzi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.5
2
+ Name: folio-kb
3
+ Version: 0.1.0
4
+ Summary: A knowledge library a coding agent builds and keeps, checked by a gate.
5
+ Project-URL: Homepage, https://github.com/pierg/folio
6
+ Project-URL: Issues, https://github.com/pierg/folio/issues
7
+ Project-URL: Documentation, https://pierg.github.io/folio/
8
+ Author: Piergiuseppe Mallozzi
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: markdown-it-py
13
+ Requires-Dist: pyyaml
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest; extra == 'dev'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # folio
19
+
20
+ folio turns your coding agent into the librarian of a knowledge library: fast, good-looking HTML pages and Markdown records that live inside any project (lab notes, study notes, a project's docs) or stand on their own. Every document has one genre, and the genre fixes its job, its voice, its format and its checks. Documents link to each other like a Zettelkasten, and maps give a reader the way in.
21
+
22
+ You do not run folio yourself. You install it by handing your agent a setup prompt, and from then on you ask in plain words: "add a concept for X", "tidy the maps", "go through my comments", "build the site". The agent follows folio's seven skills, calls the `folio` command, and runs the gate before every commit. folio is the method and the checks that keep an agent-written library honest and consistent, plus the shell that makes it pleasant to read.
23
+
24
+ <picture>
25
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pierg/folio/main/docs/assets/figures/how-folio-works-dark.svg">
26
+ <img alt="How folio works: you ask your agent in plain words; it picks one of folio's seven skills and writes typed, linked documents into the library in git, running folio check before each commit; folio serve renders the library as a site; a reader's comment is stored beside the page, and the address skill answers it and edits the page." src="https://raw.githubusercontent.com/pierg/folio/main/docs/assets/figures/how-folio-works-light.svg">
27
+ </picture>
28
+
29
+ ## Install
30
+
31
+ Paste this into your coding agent, in the project where the library should live:
32
+
33
+ ```text
34
+ Install folio here: run `uv tool install folio-kb` (or `pipx install folio-kb`), then `folio init`, then read .agents/skills/set-up/SKILL.md and follow it.
35
+ ```
36
+
37
+ The agent asks you at most three questions in one message (what the library is for, where it lives, which packs to switch on), creates the library and leaves the gate passing. A longer version of the prompt is in [SETUP.md](https://github.com/pierg/folio/blob/main/SETUP.md). folio needs Python 3.10 or later.
38
+
39
+ ## What a library looks like
40
+
41
+ A library is a folder with a `folio.yaml`. It can be a project's `docs/`, a notes folder, or a whole repository.
42
+
43
+ ```
44
+ docs/
45
+ folio.yaml the charter: name, purpose, reader, packs, home maps
46
+ content/
47
+ index.html the home page
48
+ concepts/<slug>/ one folder per genre
49
+ maps/
50
+ journal/2026/ one Markdown file per entry
51
+ assets/ figures, refs.bib, data
52
+ .folio/ generated indices, committed and checked
53
+ .agents/skills/ the seven skills, at the project root
54
+ ```
55
+
56
+ Each document keeps its facts in metadata and its prose in the body. The shell draws the header and the link panels from the metadata and the generated indices, so nothing is written twice.
57
+
58
+ <picture>
59
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pierg/folio/main/docs/assets/figures/anatomy-dark.svg">
60
+ <img alt="Anatomy of a document: the metadata in one file (genre, title, description, status, tags) becomes the page header; the body is shown as written; dates come from git; the cites, cited-by and journal panels come from the generated indices." src="https://raw.githubusercontent.com/pierg/folio/main/docs/assets/figures/anatomy-light.svg">
61
+ </picture>
62
+
63
+ Pages are plain HTML in git, readable with no build step. `folio serve` shows them locally with search, link previews, concept popovers, light and dark themes, and a comment panel; `folio export` writes a static site.
64
+
65
+ <picture>
66
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pierg/folio/main/docs/assets/figures/popover-dark.png">
67
+ <img alt="An entry in folio's shell, How corrections work, with the library rail on the left, the page panel on the right and a concept popover open over the link permanent record, showing that concept's definition." src="https://raw.githubusercontent.com/pierg/folio/main/docs/assets/figures/popover-light.png">
68
+ </picture>
69
+
70
+ Hover a link to preview the document it points to; hover a concept to read its definition without leaving the page. Readers can also comment on any rendered page, and the agent answers on the page itself.
71
+
72
+ ## Genres and packs
73
+
74
+ | Where | Genres | For |
75
+ | --- | --- | --- |
76
+ | Core | concept, note, entry, map, guide, project, journal, paper | Any library: definitions, ideas, arguments, reading paths, tutorials, the state of some work, the dated record, LaTeX papers with frozen versions. |
77
+ | knowledge-base pack | source, reading, survey | Keeping what you read: a verified citation with the original beside it, your close reading of it, and comparisons across works. Workflows: ingest, quiz. |
78
+ | lab pack | question, protocol, result, claim, report | Work tested against evidence: ranked questions, protocols locked before they run, one home per measured number, claims, plain-English reports. Workflows: record-a-result, write-a-report. |
79
+
80
+ A pack is switched on in the charter and rewrites nothing. A library can override a genre, add a variant for a second audience, or add genres, workflows and packs of its own.
81
+
82
+ ## The seven skills
83
+
84
+ | Skill | Use it to |
85
+ | --- | --- |
86
+ | set-up | Create a library in a project or a new repository, write its charter, and leave the gate passing. |
87
+ | configure | Change the charter: packs, home maps, a genre's limits, a new genre, a variant, a workflow. |
88
+ | write | Add or revise any document in its genre's voice, link its concepts, flag what goes beyond its sources, put it on a map. |
89
+ | organise | Move, merge, promote and retire documents and maps with every link, comment and date intact; run health passes. |
90
+ | address | Answer the comments readers left on rendered pages, on the page they were left on. |
91
+ | publish | Export the static site; build a paper and freeze versions of it. |
92
+ | run | Follow a workflow from a pack or the library, step by step. |
93
+
94
+ ## The gate
95
+
96
+ ```bash
97
+ folio check # every problem in one pass; changes nothing; exit 0 only when there is no error
98
+ ```
99
+
100
+ It runs offline, and CI runs the same command. It checks that every link resolves, every document meets its genre's card, no placeholder is left, records that must never change have not changed, nothing is orphaned, one fact keeps one home, and the generated indices are current.
101
+
102
+ ## Learn more
103
+
104
+ - Documentation: [pierg.github.io/folio](https://pierg.github.io/folio/). It is itself a folio library, kept in [`docs/`](https://github.com/pierg/folio/blob/main/docs/), with a guide, the concepts, and a worked example from each pack.
105
+ - The specification: [`docs/spec/`](https://github.com/pierg/folio/blob/main/docs/spec/). [`model.md`](https://github.com/pierg/folio/blob/main/docs/spec/model.md) is the contract the rest builds on; when anything disagrees with it, it wins.
106
+ - Contributing: [CONTRIBUTING.md](https://github.com/pierg/folio/blob/main/CONTRIBUTING.md). Changes: [CHANGELOG.md](https://github.com/pierg/folio/blob/main/CHANGELOG.md).
107
+
108
+ ## License
109
+
110
+ MIT. See [LICENSE](https://github.com/pierg/folio/blob/main/LICENSE).
@@ -0,0 +1,93 @@
1
+ # folio
2
+
3
+ folio turns your coding agent into the librarian of a knowledge library: fast, good-looking HTML pages and Markdown records that live inside any project (lab notes, study notes, a project's docs) or stand on their own. Every document has one genre, and the genre fixes its job, its voice, its format and its checks. Documents link to each other like a Zettelkasten, and maps give a reader the way in.
4
+
5
+ You do not run folio yourself. You install it by handing your agent a setup prompt, and from then on you ask in plain words: "add a concept for X", "tidy the maps", "go through my comments", "build the site". The agent follows folio's seven skills, calls the `folio` command, and runs the gate before every commit. folio is the method and the checks that keep an agent-written library honest and consistent, plus the shell that makes it pleasant to read.
6
+
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/figures/how-folio-works-dark.svg">
9
+ <img alt="How folio works: you ask your agent in plain words; it picks one of folio's seven skills and writes typed, linked documents into the library in git, running folio check before each commit; folio serve renders the library as a site; a reader's comment is stored beside the page, and the address skill answers it and edits the page." src="docs/assets/figures/how-folio-works-light.svg">
10
+ </picture>
11
+
12
+ ## Install
13
+
14
+ Paste this into your coding agent, in the project where the library should live:
15
+
16
+ ```text
17
+ Install folio here: run `uv tool install folio-kb` (or `pipx install folio-kb`), then `folio init`, then read .agents/skills/set-up/SKILL.md and follow it.
18
+ ```
19
+
20
+ The agent asks you at most three questions in one message (what the library is for, where it lives, which packs to switch on), creates the library and leaves the gate passing. A longer version of the prompt is in [SETUP.md](SETUP.md). folio needs Python 3.10 or later.
21
+
22
+ ## What a library looks like
23
+
24
+ A library is a folder with a `folio.yaml`. It can be a project's `docs/`, a notes folder, or a whole repository.
25
+
26
+ ```
27
+ docs/
28
+ folio.yaml the charter: name, purpose, reader, packs, home maps
29
+ content/
30
+ index.html the home page
31
+ concepts/<slug>/ one folder per genre
32
+ maps/
33
+ journal/2026/ one Markdown file per entry
34
+ assets/ figures, refs.bib, data
35
+ .folio/ generated indices, committed and checked
36
+ .agents/skills/ the seven skills, at the project root
37
+ ```
38
+
39
+ Each document keeps its facts in metadata and its prose in the body. The shell draws the header and the link panels from the metadata and the generated indices, so nothing is written twice.
40
+
41
+ <picture>
42
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/figures/anatomy-dark.svg">
43
+ <img alt="Anatomy of a document: the metadata in one file (genre, title, description, status, tags) becomes the page header; the body is shown as written; dates come from git; the cites, cited-by and journal panels come from the generated indices." src="docs/assets/figures/anatomy-light.svg">
44
+ </picture>
45
+
46
+ Pages are plain HTML in git, readable with no build step. `folio serve` shows them locally with search, link previews, concept popovers, light and dark themes, and a comment panel; `folio export` writes a static site.
47
+
48
+ <picture>
49
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/figures/popover-dark.png">
50
+ <img alt="An entry in folio's shell, How corrections work, with the library rail on the left, the page panel on the right and a concept popover open over the link permanent record, showing that concept's definition." src="docs/assets/figures/popover-light.png">
51
+ </picture>
52
+
53
+ Hover a link to preview the document it points to; hover a concept to read its definition without leaving the page. Readers can also comment on any rendered page, and the agent answers on the page itself.
54
+
55
+ ## Genres and packs
56
+
57
+ | Where | Genres | For |
58
+ | --- | --- | --- |
59
+ | Core | concept, note, entry, map, guide, project, journal, paper | Any library: definitions, ideas, arguments, reading paths, tutorials, the state of some work, the dated record, LaTeX papers with frozen versions. |
60
+ | knowledge-base pack | source, reading, survey | Keeping what you read: a verified citation with the original beside it, your close reading of it, and comparisons across works. Workflows: ingest, quiz. |
61
+ | lab pack | question, protocol, result, claim, report | Work tested against evidence: ranked questions, protocols locked before they run, one home per measured number, claims, plain-English reports. Workflows: record-a-result, write-a-report. |
62
+
63
+ A pack is switched on in the charter and rewrites nothing. A library can override a genre, add a variant for a second audience, or add genres, workflows and packs of its own.
64
+
65
+ ## The seven skills
66
+
67
+ | Skill | Use it to |
68
+ | --- | --- |
69
+ | set-up | Create a library in a project or a new repository, write its charter, and leave the gate passing. |
70
+ | configure | Change the charter: packs, home maps, a genre's limits, a new genre, a variant, a workflow. |
71
+ | write | Add or revise any document in its genre's voice, link its concepts, flag what goes beyond its sources, put it on a map. |
72
+ | organise | Move, merge, promote and retire documents and maps with every link, comment and date intact; run health passes. |
73
+ | address | Answer the comments readers left on rendered pages, on the page they were left on. |
74
+ | publish | Export the static site; build a paper and freeze versions of it. |
75
+ | run | Follow a workflow from a pack or the library, step by step. |
76
+
77
+ ## The gate
78
+
79
+ ```bash
80
+ folio check # every problem in one pass; changes nothing; exit 0 only when there is no error
81
+ ```
82
+
83
+ It runs offline, and CI runs the same command. It checks that every link resolves, every document meets its genre's card, no placeholder is left, records that must never change have not changed, nothing is orphaned, one fact keeps one home, and the generated indices are current.
84
+
85
+ ## Learn more
86
+
87
+ - Documentation: [pierg.github.io/folio](https://pierg.github.io/folio/). It is itself a folio library, kept in [`docs/`](docs/), with a guide, the concepts, and a worked example from each pack.
88
+ - The specification: [`docs/spec/`](docs/spec/). [`model.md`](docs/spec/model.md) is the contract the rest builds on; when anything disagrees with it, it wins.
89
+ - Contributing: [CONTRIBUTING.md](CONTRIBUTING.md). Changes: [CHANGELOG.md](CHANGELOG.md).
90
+
91
+ ## License
92
+
93
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,10 @@
1
+ # Craft
2
+
3
+ How to show something on a page so the reader sees it at once. Each file is short and covers one kind of thing. The components and tokens they use are in `shell/COMPONENTS.md`.
4
+
5
+ - [`layout.md`](layout.md): the reading column, and when a page may go wider.
6
+ - [`figures.md`](figures.md): when a figure earns its place, and how to make one.
7
+ - [`tables.md`](tables.md): tables that compare, and how to keep them readable.
8
+ - [`diagrams.md`](diagrams.md): drawing a mechanism as inline SVG that works in both themes.
9
+
10
+ The rule behind all four: show the one thing the reader needs, in the plainest form that shows it, and say in the caption what to look at.
@@ -0,0 +1,43 @@
1
+ # Diagrams
2
+
3
+ A diagram shows how something works: the parts, and what moves between them. It is worth drawing when the reader would otherwise hold four or more parts in their head at once.
4
+
5
+ ## Draw the real mechanism
6
+
7
+ - Name the parts as the text names them. A box called "Processor" in a page about "the softmax step" is a second vocabulary.
8
+ - Show what flows, and which way. Arrows carry one meaning per diagram: data, or control, or time, never a mix.
9
+ - Leave out what the point does not need. A diagram of everything shows nothing.
10
+ - If the order matters, number the steps and use the same numbers in the text.
11
+
12
+ ## Inline SVG in both themes
13
+
14
+ Write the SVG inside the page so it can use the shell's tokens:
15
+
16
+ ```html
17
+ <figure>
18
+ <svg viewBox="0 0 320 80" role="img" aria-label="A row of scores goes through the softmax and comes out as weights">
19
+ <g style="fill: none; stroke: var(--ink-2); stroke-width: 1.5">
20
+ <rect x="10" y="25" width="80" height="30" rx="4"/>
21
+ <rect x="230" y="25" width="80" height="30" rx="4"/>
22
+ <path d="M90 40 H230" marker-end="url(#arrow)"/>
23
+ </g>
24
+ <g style="fill: var(--ink); font: 12px var(--sans)" text-anchor="middle">
25
+ <text x="50" y="44">scores</text>
26
+ <text x="270" y="44">weights</text>
27
+ </g>
28
+ <defs><marker id="arrow" viewBox="0 0 8 8" refX="8" refY="4" markerWidth="8" markerHeight="8" orient="auto">
29
+ <path d="M0 0 L8 4 L0 8 z" style="fill: var(--ink-2)"/></marker></defs>
30
+ </svg>
31
+ <figcaption>The softmax turns each row of scores into weights that sum to one.</figcaption>
32
+ </figure>
33
+ ```
34
+
35
+ - Fill and stroke come from tokens (`var(--ink)`, `var(--ink-2)`, `var(--rule)`, `var(--accent)`), set in `style`, never from hex values. A token works in `style`, not in a plain `fill=` attribute.
36
+ - Use the accent for the one part the caption names. Everything else is ink or rule.
37
+ - Text is at least 12 units at the `viewBox` width, so it stays legible on a phone.
38
+ - Give the SVG `role="img"` and an `aria-label` that says what it shows.
39
+ - Keep a `viewBox` and no fixed width, so it scales to the column.
40
+
41
+ ## Before you keep it
42
+
43
+ Look at it at phone width and in dark mode. If a label is too small or a line disappears, fix the drawing, not the page.
@@ -0,0 +1,38 @@
1
+ # Figures
2
+
3
+ ## When a figure earns its place
4
+
5
+ Draw a figure when the reader must see a shape: a trend, a comparison of sizes, a structure, the steps of a process. If one sentence says it as well, write the sentence.
6
+
7
+ Each figure makes one point. Write that point first, as the caption. If you cannot write it in one sentence, the figure is doing two jobs: make two figures.
8
+
9
+ ## Where it lives
10
+
11
+ - The source and the rendered file go in `assets/figures/`. Link it from the root: `/assets/figures/<name>.svg`.
12
+ - Prefer SVG. Use PNG only for photographs or screenshots.
13
+ - A paper, a report and a page that show the same result reuse the same file. Never copy it.
14
+
15
+ ## The markup
16
+
17
+ ```html
18
+ <figure>
19
+ <img src="/assets/figures/attention-tiling.svg" alt="Queries are scored against one tile of keys at a time, and the running softmax is rescaled after each tile">
20
+ <figcaption>Each new tile rescales the running sum before adding to it.</figcaption>
21
+ </figure>
22
+ ```
23
+
24
+ - `alt` says what the figure shows, for a reader who cannot see it.
25
+ - The caption says what to look at, not what the figure is. "Each new tile rescales the running sum" beats "Diagram of FlashAttention tiling".
26
+ - A number in a caption cites its source, like any number on the page.
27
+
28
+ ## Charts
29
+
30
+ - Pick the form by the question. Change over time: a line. Comparing a few amounts: bars from zero. Parts of a whole: a single stacked bar, not a pie.
31
+ - Label lines and bars directly, at their ends. Avoid a legend the eye must travel to.
32
+ - Keep to two or three colours, from the tokens. Grey for context, the accent for the thing the caption names.
33
+ - Start a bar's axis at zero. Say when a line's axis does not.
34
+ - Remove what does not carry data: heavy grids, borders, shadows, 3D.
35
+
36
+ ## Both themes
37
+
38
+ An SVG that hard-codes black text vanishes in dark mode. Use `currentColor` for text and lines, or inline the SVG and use the shell's tokens (see `diagrams.md`). A PNG needs a background that reads on both, or a transparent one tested on both.
@@ -0,0 +1,32 @@
1
+ # Layout
2
+
3
+ ## The reading column
4
+
5
+ Prose sits in one column about 68 characters wide (`--measure`). That width is easy to read and is the same on every page. Do not set widths on paragraphs, and do not put prose side by side.
6
+
7
+ On a wide screen the page panel sits to the right of the column. On a narrow screen it follows the page. Nothing a page writes goes in the panel.
8
+
9
+ ## Order
10
+
11
+ - The body starts with content. The shell has already drawn the title, the description and the metadata.
12
+ - Use `<h2>` for the parts of the argument and `<h3>` for small labelled parts inside one. Never skip to `<h4>` for size. The outline is built from `<h2>` and `<h3>`.
13
+ - One idea per section. If a section needs two headings inside it, it is two sections.
14
+ - Put a check-yourself at the end of the section it tests, not at the end of the page.
15
+
16
+ ## Going wider
17
+
18
+ A table, a figure or a code block may need more than the column. It keeps to the column, and scrolls sideways inside its own box on a small screen. The page itself never scrolls sideways.
19
+
20
+ If a figure only reads at a larger size, link the full-size file from the caption rather than stretching the page.
21
+
22
+ ## Phones
23
+
24
+ Check every page at phone width. Watch for:
25
+
26
+ - long words or paths that do not wrap (wrap them in `<code>`; the shell lets code break);
27
+ - tables with more than four columns (split them, or turn them around so rows are the long side);
28
+ - figures with small text (redraw them with fewer, larger labels).
29
+
30
+ ## Space
31
+
32
+ Leave space to the shell. Do not add `<br>` or empty paragraphs to push things apart, and do not set margins inline. If something looks cramped, the structure is usually wrong: a list written as a paragraph, or two ideas in one section.
@@ -0,0 +1,34 @@
1
+ # Tables
2
+
3
+ ## When to use one
4
+
5
+ Use a table when the reader compares the same few facts across several things. Each row is a thing; each column is one fact about it. If there is one fact per thing, use a list. If there are two things, write a sentence.
6
+
7
+ ## Shape
8
+
9
+ - Put the things down the side and the facts across the top. A table with many rows and few columns reads on a phone; the reverse does not.
10
+ - Keep to about five columns. Split a wider table into two that each answer one question.
11
+ - Order the rows by what matters most to the reader, not alphabetically, unless the reader will look a row up by name.
12
+ - The first column names the row. In a survey, it links the source.
13
+
14
+ ## Cells
15
+
16
+ - Numbers: same unit and precision down a column, unit in the header, not in each cell. Right-align them with `class="num"`.
17
+ - Empty is not the same as zero. Write "not reported" or use `<span class="not-measured">` for what was not measured.
18
+ - Keep cells short: a fact, not a sentence. A cell that needs a sentence is a footnote under the table.
19
+ - Every number cites its source in the same row, as the gate asks.
20
+
21
+ ## Markup
22
+
23
+ ```html
24
+ <table class="compare">
25
+ <thead>
26
+ <tr><th>Work</th><th class="num">Year</th><th>Exact attention</th></tr>
27
+ </thead>
28
+ <tbody>
29
+ <tr><td><a href="/content/sources/2017-attention-is-all-you-need/">Attention Is All You Need</a></td><td class="num">2017</td><td>yes</td></tr>
30
+ </tbody>
31
+ </table>
32
+ ```
33
+
34
+ Use `<thead>` and `<th>`. A `<caption>` may say what to read across. Do not style a table inline: the shell sets the rules, the spacing and the scrolling on a small screen.
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: concept
3
+ format: html
4
+ path: content/concepts/{slug}/index.html
5
+ id: slug
6
+ skeleton: skeleton.html
7
+ lives: revised
8
+ states: [draft, live, historical, retired]
9
+ checks:
10
+ require: [defn]
11
+ forbid: [h2]
12
+ max_words: 250
13
+ cites: { defn: none }
14
+ defined_once: true
15
+ on_map: optional
16
+ ---
17
+
18
+ # Concept
19
+
20
+ A concept defines one term, once, so that every other document can link to it instead of explaining it again.
21
+
22
+ ## Reader
23
+
24
+ Someone who met the term on another page and wants it pinned down. Often they read only the definition, in the popover that shows when they hover a link. They have no context beyond that definition.
25
+
26
+ ## Voice
27
+
28
+ Impersonal, present tense, timeless. No "we", no "I", no story of how the term came about. The definition stays true when any result or number changes.
29
+
30
+ > The softmax turns a row of scores into weights that are positive and sum to one.
31
+
32
+ ## Metadata
33
+
34
+ No fields beyond the core. The `title` is the term, as a reader would search for it. The `description` says in one sentence what the concept is for. It is not the definition: the definition lives in the `defn`.
35
+
36
+ ## Shape
37
+
38
+ The shell draws the term and the description above the body. The body starts with the definition.
39
+
40
+ 1. `defn`: a `<blockquote class="defn" id="{slug}">`. It opens with `<span class="defn-name">` holding the term alone. Then one to three sentences follow. This is the sentence other pages cite and the popover shows. Every symbol in it is named in it or is a `defn-link`.
41
+ 2. A figure, optional. One `<figure>` that makes the idea obvious, with a `<figcaption>` that says what to see. A figure other documents also use comes from `assets/figures/`.
42
+ 3. Short sections, optional, each under an `<h3>`. "Why it matters" takes two to four sentences. "The trap" names the usual misreading. "Related" links neighbouring concepts in a sentence or two.
43
+
44
+ ## Forbidden
45
+
46
+ - An `<h2>` section. A concept that needs sections is an entry. Caught by `forbid: [h2]`.
47
+ - More than 250 words. Caught by `max_words`.
48
+ - A citation inside the definition. Caught by `cites: { defn: none }`, which applies to the `defn` only. Sources and results may be cited below it.
49
+ - A second definition of the same term. Caught by `defined_once`: no other document carries a `defn` with the same `defn-name`.
50
+ - A prose re-explanation of the term on another page. Judged, not checked.
51
+ - A label after the term in `defn-name`, such as "Softmax, definition". Judged, not checked.
52
+ - A concept for a part of one particular system. That stays as prose in its entry. Judged, not checked.
53
+
54
+ ## Steps
55
+
56
+ - Search before writing: `folio search <term>`. If the term is defined, link to it or revise it. Never add a second one.
57
+ - A concept earns its page when the idea is transferable, not trivial, and needed on at least two documents. Judged, not checked. The organise skill folds a thin concept into its entry with `folio rm --to`.
58
+ - After writing it, replace every other explanation of the term with `<a class="defn-link" href="/content/concepts/{slug}/">`. The write skill does this sweep.
59
+ - Delete the optional parts you do not use. A placeholder left in the page is reported by the gate.
60
+ - An invented example or figure gets a flag, because the source did not say it.
61
+
62
+ ## Lifecycle
63
+
64
+ Revised in place. The slug is the id and never changes; a move uses `folio mv`. A concept is born when a term needs explaining a second time, often out of a note or an entry's section. It becomes `historical` when the library stops using the term. It becomes `retired` when merged into another concept with `folio rm --to`. If it outgrows 250 words, the long form moves into an entry and the concept stays short.
65
+
66
+ ## Example
67
+
68
+ ```html
69
+ <meta name="title" content="Softmax">
70
+ <meta name="description" content="The function that turns attention scores into weights.">
71
+ <!-- body -->
72
+ <blockquote class="defn" id="softmax">
73
+ <span class="defn-name">Softmax</span><br>
74
+ The softmax of a vector of scores is the exponential of each score divided by the sum of the exponentials of all of them.
75
+ </blockquote>
76
+ <h3>The trap</h3>
77
+ <p>Computed as written, the exponentials overflow for large scores. Adding the same constant to every score leaves the result unchanged, so implementations subtract the maximum first.</p>
78
+ ```
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>{{term}}</title>
7
+ <meta name="genre" content="{genre}">
8
+ <meta name="title" content="{{term}}">
9
+ <meta name="description" content="{{one sentence: what this concept is for}}">
10
+ <meta name="tags" content="{{tags}}">
11
+ <link rel="stylesheet" href="/shell/folio.css">
12
+ <script src="/shell/folio.js" defer></script>
13
+ </head>
14
+ <body>
15
+ <main>
16
+
17
+ <blockquote class="defn" id="{slug}">
18
+ <span class="defn-name">{{term}}</span><br>
19
+ {{one to three sentences that define the term; no citations; every symbol named here}}
20
+ </blockquote>
21
+
22
+ <figure>
23
+ {{optional: one figure that makes the idea obvious}}
24
+ <figcaption>{{what the reader should see}}</figcaption>
25
+ </figure>
26
+
27
+ <h3>Why it matters</h3>
28
+ <p>{{two to four sentences: what the concept buys, and where it is used}}</p>
29
+
30
+ <h3>The trap</h3>
31
+ <p>{{the usual misreading, named precisely}}</p>
32
+
33
+ <h3>Related</h3>
34
+ <p>{{how it sits next to}} <a class="defn-link" href="{{link to a neighbouring concept}}">{{neighbour}}</a>.</p>
35
+
36
+ </main>
37
+ </body>
38
+ </html>
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: entry
3
+ format: html
4
+ path: content/entries/{slug}/index.html
5
+ id: slug
6
+ skeleton: skeleton.html
7
+ lives: revised
8
+ states: [draft, live, historical, retired]
9
+ checks:
10
+ require: [thesis, h2]
11
+ cites: any
12
+ on_map: required
13
+ ---
14
+
15
+ # Entry
16
+
17
+ An entry explains or analyses one subject in depth, takes a position on it, and cites what each claim rests on.
18
+
19
+ ## Reader
20
+
21
+ Interested and capable, but not an expert in this subject. They will read for several minutes and want to navigate by section.
22
+
23
+ ## Voice
24
+
25
+ Analytical. It takes a position and supports it. Each claim cites what it rests on, where the claim is made: a source, a result, a concept, another entry. Uncertainty is stated once, precisely, never spread as hedging.
26
+
27
+ > Every token scores against every other token, so doubling the context quadruples the scores.
28
+
29
+ ## Metadata
30
+
31
+ No fields beyond the core. The `title` is the subject. The `description` says in one sentence what the entry covers, and for whom.
32
+
33
+ ## Shape
34
+
35
+ The shell draws the title and description above the body, and the generated panels list what the entry cites and what cites it. So the body has no list of what it rests on.
36
+
37
+ 1. `thesis`: a `<p class="thesis">` that opens the body. It states the entry's position in one to three sentences.
38
+ 2. `h2`: sections, each under an `<h2 id="...">`. The sections carry the argument, one step each. A figure goes where it carries a step.
39
+ 3. Check-yourself, optional: `<details class="check"><summary>question</summary><div class="ans">answer</div></details>` at the end of a section.
40
+
41
+ Files only this entry uses, such as a source's full text, may sit beside `index.html` in its folder. A figure other documents also use lives in `assets/figures/`.
42
+
43
+ ## Forbidden
44
+
45
+ - A wall of prose with no sections. Caught by `require: [h2]`.
46
+ - An entry that cites nothing. Caught by `cites: any`, which needs at least one resolving citation.
47
+ - A closing "What this rests on" list. The generated panel shows what the entry cites. Judged, not checked.
48
+ - A missing statement of position. Caught by `require: [thesis]`. Whether it is a real position is judged, not checked.
49
+ - A claim with no support where it is made. Judged, not checked.
50
+ - A definition written out again when a concept holds it. A second `defn` is caught by `defined_once`, which compares every `defn` in the library. A prose re-explanation is judged, not checked. Link the concept instead.
51
+ - A number restated as the entry's own when another document holds it. Judged, not checked; a pack can make it a check.
52
+
53
+ ## Steps
54
+
55
+ - Before writing, list the concepts the subject needs. Link each with `class="defn-link"`. A term the entry must define, and another page also needs, becomes a concept first.
56
+ - Write the thesis last, then move it to the top. It must match where the sections actually land.
57
+ - Anything the sources did not say (an example, a framing, a claim from general knowledge) gets a flag.
58
+ - Add the entry to at least one map: `folio map add <map> <doc>`. Give a `--reason` only when it says more than the description.
59
+
60
+ ## Lifecycle
61
+
62
+ Revised in place, and the most revised genre. A note that grew sections is promoted into an entry. An entry that has become a teaching sequence is split into a guide, with the entry left as the reference or retired into it. An entry overtaken by a better one is `retired` into it with `folio rm --to`. One that was true of its time is `historical`, with its description saying when.
63
+
64
+ ## Example
65
+
66
+ ```html
67
+ <meta name="title" content="Why attention is quadratic">
68
+ <meta name="description" content="Where the n-squared cost of self-attention comes from, for someone who knows matrix products well.">
69
+ <!-- body -->
70
+ <p class="thesis">Every token scores against every other token. A sequence of n tokens makes n squared scores, so the cost grows with the square of the context.</p>
71
+ <h2 id="scores">Where the scores come from</h2>
72
+ <p>The product of the queries and the transposed keys is an n-by-n matrix ...</p>
73
+ <h2 id="memory">What tiling changes, and what it does not</h2>
74
+ <p>Each row of scores goes through a <a class="defn-link" href="/content/concepts/softmax/">softmax</a>, which tiling can compute without storing the matrix ...</p>
75
+ ```
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>{{title}}</title>
7
+ <meta name="genre" content="{genre}">
8
+ <meta name="title" content="{{title}}">
9
+ <meta name="description" content="{{one sentence: what this entry covers, and for whom}}">
10
+ <meta name="tags" content="{{tags}}">
11
+ <link rel="stylesheet" href="/shell/folio.css">
12
+ <script src="/shell/folio.js" defer></script>
13
+ </head>
14
+ <body>
15
+ <main>
16
+
17
+ <p class="thesis">{{the entry's position, in one to three sentences}}</p>
18
+
19
+ <h2 id="{{section-id}}">{{first step of the argument}}</h2>
20
+ <p>{{the argument, each claim citing what it rests on, and each term linked to its}} <a class="defn-link" href="{{link to a concept}}">{{concept}}</a>.</p>
21
+
22
+ <details class="check">
23
+ <summary>{{a question the reader should now be able to answer}}</summary>
24
+ <div class="ans">{{the answer}}</div>
25
+ </details>
26
+
27
+ </main>
28
+ </body>
29
+ </html>