Skip to content

Commit d31f704

Browse files
authored
Trim always-loaded Claude context and add llm-docs discovery (#14701)
Trim always-loaded Claude context and add llm-docs discovery Reduce the baseline token cost of every Claude Code session on the repo, and make the llm-docs/ architecture deep-dives discoverable. The always-loaded .claude/CLAUDE.md had grown well past the ~200-line guidance for memory files, and the llm-docs/ docs had no mechanism steering a reader to the relevant one for a given task. - Compress .claude/CLAUDE.md from 276 to 79 lines, removing only codebase-derivable prose and content duplicated by the rule files - Add a one-line discovery pointer from a path-scoped .claude/rules/ file to each llm-docs/*.md, scoped to the doc's own source so it loads lazily and never fires on unrelated work - Add small dedicated rules for topics with no narrow existing rule: revealjs, axe, callout, localization, quarto-api, pandoc templates, preview, publishing, code signing - Have CLAUDE.md instruct consulting llm-docs/ directly when planning or investigating, since path-scoped pointers only fire once a matching file is open - Converge duplicated rule content to single sources and record the discovery-pointer convention in llm-docs-maintenance.md
1 parent 2e66958 commit d31f704

18 files changed

Lines changed: 157 additions & 264 deletions

.claude/CLAUDE.md

Lines changed: 43 additions & 240 deletions
Large diffs are not rendered by default.

.claude/rules/filters/overview.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,7 @@ Reach for it when a Pandoc *parsing* behavior must change before any filter can
6868

6969
## Debugging
7070

71-
**Filter tracing (recommended):**
72-
```bash
73-
# Linux/macOS
74-
package/dist/bin/quarto dev-call show-ast-trace document.qmd
75-
76-
# Windows
77-
package/dist/bin/quarto.cmd dev-call show-ast-trace document.qmd
78-
```
79-
80-
**AST diagram:**
81-
```bash
82-
quarto dev-call make-ast-diagram document.qmd
83-
```
71+
Visualize filter transformations with the `dev-call` tools `show-ast-trace` (interactive trace viewer) and `make-ast-diagram` (static AST diagram) — see `.claude/rules/dev-tools/dev-call-commands.md` for both.
8472

8573
## Related Documentation
8674

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
paths:
3+
- "src/format/html/format-html-axe*"
4+
- "src/resources/**/*axe*"
5+
- "tests/integration/playwright/tests/*axe*"
6+
---
7+
8+
# Axe Accessibility Checks
9+
10+
For the axe-core integration architecture across build-time TypeScript, compile-time SCSS, and runtime JS layers, see `llm-docs/axe-accessibility-architecture.md`.
11+
12+
For the axe accessibility testing workflow (scan config, runtime DOM markers, output-mode patching), see `llm-docs/axe-accessibility-testing.md`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
paths:
3+
- "src/resources/formats/**/*callout*"
4+
- "src/resources/filters/**/callout*"
5+
---
6+
7+
# Callout Styling
8+
9+
For the three-tier callout CSS architecture (Bootstrap, RevealJS, standalone HTML), see `llm-docs/callout-styling-html.md`.
10+
11+
The shared SCSS where callout CSS lives (`_bootstrap-rules.scss`, `revealjs/quarto.scss`) is covered by the `sass-theming` rule, which also points to this doc.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
paths:
3+
- "src/resources/formats/pdf/pandoc/**"
4+
- "src/resources/formats/typst/pandoc/**"
5+
- "package/src/common/update-pandoc.ts"
6+
---
7+
8+
# Pandoc Templates (LaTeX & Typst)
9+
10+
For how Pandoc's LaTeX templates are copied into Quarto and restructured into a modular form (`latex.template`, `latex.common`, …), see `llm-docs/pandoc-quarto-latex-templates.md`.
11+
12+
For the equivalent Typst template integration (`typst.template`, `template.typst`), see `llm-docs/pandoc-quarto-typst-templates.md`.

.claude/rules/formats/revealjs.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
paths:
3+
- "src/format/reveal/**"
4+
- "src/resources/formats/revealjs/**"
5+
---
6+
7+
# RevealJS Format
8+
9+
For reveal.js format internals — metadata normalization, the two template files (`revealjs.template` vs `template.html`), and the TypeScript/Pandoc division of responsibility — see `llm-docs/revealjs-format-architecture.md`.

.claude/rules/formats/sass-theming.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ background-color: var(--r-background-color, $body-bg);
2020
```
2121

2222
Read `llm-docs/sass-theming-architecture.md` for full compilation pipeline details.
23+
24+
For the three-tier callout CSS architecture (Bootstrap, RevealJS, standalone HTML), see `llm-docs/callout-styling-html.md`.

.claude/rules/llm-docs-maintenance.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ They are NOT:
5555
- User documentation (that's at quarto.org)
5656
- Code comments (those live in source files)
5757
- Issue-specific notes (those go in PR descriptions)
58+
59+
## Discovery Pointers
60+
61+
So a relevant deep-dive actually gets read when a matching task comes up, each `llm-docs/*.md` should be reachable from a **discovery pointer** — a one-line "see `llm-docs/<file>.md`" reference — placed inside a path-scoped rule under `.claude/rules/` whose `paths:` frontmatter matches the doc's own source files. This reuses the existing lazy-load gate at zero baseline context cost.
62+
63+
Granularity rule: the pointer inherits its host rule's `paths:`, so it must live in a rule scoped **no broader than the doc's topic** — otherwise it loads on unrelated work (a reveal.js pointer does not belong in a rule scoped to all of `src/format/**`). If the best existing rule is too generic, create a small dedicated rule scoped to that doc's source instead.
64+
65+
**When adding a new `llm-docs/*.md`:** add its discovery pointer to a matching path-scoped rule, or create a narrowly-scoped rule for it.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
paths:
3+
- "package/src/macos/installer.ts"
4+
- "package/src/windows/installer.ts"
5+
- "package/scripts/macos/entitlements.plist"
6+
- "package/scripts/macos/distribution.xml"
7+
- ".github/workflows/create-release.yml"
8+
- ".github/workflows/actions/keychain/action.yml"
9+
- ".github/workflows/actions/sign-files/action.yml"
10+
---
11+
12+
# Code Signing for Installers
13+
14+
For how release installers get signed and notarized on macOS and Windows (Gatekeeper, SmartScreen, and the keychain/signing actions in `create-release.yml`), see `llm-docs/code-signing-installers.md`.

.claude/rules/preview/overview.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
paths:
3+
- "src/command/preview/**"
4+
- "src/project/serve/**"
5+
- "src/preview/**"
6+
---
7+
8+
# Preview System
9+
10+
For how `quarto preview` works end-to-end — CLI entry, the branching logic in `cmd.ts`, single-file vs project preview lifecycle, and file watching — see `llm-docs/preview-architecture.md`.

0 commit comments

Comments
 (0)