@joshski/dust 0.1.105 → 0.1.107

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 (66) hide show
  1. package/README.md +2 -3
  2. package/dist/artifacts.js +25 -10
  3. package/dist/audits.js +296 -0
  4. package/dist/core-principles.js +1401 -87
  5. package/dist/dust.js +1909 -264
  6. package/package.json +2 -3
  7. package/.dust/principles/actionable-errors.md +0 -18
  8. package/.dust/principles/agent-agnostic-design.md +0 -21
  9. package/.dust/principles/agent-autonomy.md +0 -19
  10. package/.dust/principles/agent-context-inference.md +0 -19
  11. package/.dust/principles/agent-specific-enhancement.md +0 -23
  12. package/.dust/principles/agentic-flow-state.md +0 -24
  13. package/.dust/principles/atomic-commits.md +0 -15
  14. package/.dust/principles/batteries-included.md +0 -17
  15. package/.dust/principles/boy-scout-rule.md +0 -15
  16. package/.dust/principles/broken-windows.md +0 -17
  17. package/.dust/principles/clarity-over-brevity.md +0 -13
  18. package/.dust/principles/co-located-tests.md +0 -13
  19. package/.dust/principles/comprehensive-assertions.md +0 -50
  20. package/.dust/principles/comprehensive-test-coverage.md +0 -15
  21. package/.dust/principles/consistent-naming.md +0 -13
  22. package/.dust/principles/context-optimised-code.md +0 -15
  23. package/.dust/principles/context-window-efficiency.md +0 -15
  24. package/.dust/principles/cross-platform-compatibility.md +0 -19
  25. package/.dust/principles/debugging-tooling.md +0 -19
  26. package/.dust/principles/decoupled-code.md +0 -16
  27. package/.dust/principles/dependency-injection.md +0 -15
  28. package/.dust/principles/design-for-testability.md +0 -17
  29. package/.dust/principles/development-traceability.md +0 -19
  30. package/.dust/principles/easy-adoption.md +0 -17
  31. package/.dust/principles/environment-independent-tests.md +0 -19
  32. package/.dust/principles/exploratory-tooling.md +0 -19
  33. package/.dust/principles/fast-feedback-loops.md +0 -15
  34. package/.dust/principles/fast-feedback.md +0 -13
  35. package/.dust/principles/functional-core-imperative-shell.md +0 -15
  36. package/.dust/principles/human-ai-collaboration.md +0 -18
  37. package/.dust/principles/ideal-agent-developer-experience.md +0 -24
  38. package/.dust/principles/intuitive-directory-structure.md +0 -13
  39. package/.dust/principles/keep-unit-tests-pure.md +0 -25
  40. package/.dust/principles/lightweight-planning.md +0 -16
  41. package/.dust/principles/lint-everything.md +0 -19
  42. package/.dust/principles/maintainable-codebase.md +0 -21
  43. package/.dust/principles/make-changes-with-confidence.md +0 -23
  44. package/.dust/principles/make-the-change-easy.md +0 -15
  45. package/.dust/principles/minimal-dependencies.md +0 -13
  46. package/.dust/principles/naming-matters.md +0 -14
  47. package/.dust/principles/progressive-disclosure.md +0 -15
  48. package/.dust/principles/readable-test-data.md +0 -48
  49. package/.dust/principles/reasonably-dry.md +0 -13
  50. package/.dust/principles/repository-hygiene.md +0 -14
  51. package/.dust/principles/reproducible-checks.md +0 -13
  52. package/.dust/principles/runtime-agnostic-tests.md +0 -13
  53. package/.dust/principles/self-contained-repository.md +0 -17
  54. package/.dust/principles/self-diagnosing-tests.md +0 -54
  55. package/.dust/principles/slow-feedback-coping.md +0 -15
  56. package/.dust/principles/small-units.md +0 -17
  57. package/.dust/principles/some-big-design-up-front.md +0 -34
  58. package/.dust/principles/stop-the-line.md +0 -13
  59. package/.dust/principles/stubs-over-mocks.md +0 -19
  60. package/.dust/principles/task-first-workflow.md +0 -13
  61. package/.dust/principles/test-isolation.md +0 -19
  62. package/.dust/principles/traceable-decisions.md +0 -13
  63. package/.dust/principles/trunk-based-development.md +0 -19
  64. package/.dust/principles/unit-test-coverage.md +0 -13
  65. package/.dust/principles/unsurprising-ux.md +0 -15
  66. package/.dust/principles/vcs-independence.md +0 -13
@@ -1,8 +1,1362 @@
1
- // lib/core-principles.ts
2
- import { join, dirname } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { existsSync, readdirSync } from "node:fs";
5
- import { readFile } from "node:fs/promises";
1
+ // lib/bundled-core-principles.ts
2
+ var BUNDLED_PRINCIPLES = [
3
+ {
4
+ slug: "batteries-included",
5
+ content: `# Batteries Included
6
+
7
+ Dust should provide everything that is required (within reason) for an agent to be productive in an arbitrary codebase.
8
+
9
+ An agent working autonomously should not be blocked because a tool or configuration is missing. For example, dust should ship custom lint rules for different linters, even though those linters are not dependencies of dust itself. If an agent needs a capability to do its job well in a typical codebase, dust should provide it out of the box.
10
+
11
+ This means accepting some breadth of scope — bundling configs, rules, and utilities that target external tools — in exchange for agents that can start producing useful work immediately without manual setup.
12
+
13
+ ## Applicability
14
+
15
+ Internal
16
+
17
+ ## Parent Principle
18
+
19
+ - [Agent Autonomy](agent-autonomy.md)
20
+
21
+ ## Sub-Principles
22
+ `
23
+ },
24
+ {
25
+ slug: "some-big-design-up-front",
26
+ content: `# Some Big Design Up Front
27
+
28
+ AI agents lower the cost of architectural exploration, making heavier upfront investment rational during the idea phase.
29
+
30
+ Agile's rejection of "big design up front" (BDUF) was largely economic: detailed architecture was expensive to produce and often wrong. AI agents change that equation — they can explore multiple variants, prototype them, and measure trade-offs cheaply. When evaluating alternatives costs less, the expected value of avoiding large structural mistakes increases.
31
+
32
+ This doesn't mean returning to traditional BDUF. Uncertainty about future requirements still limits what prediction can achieve. The insight is that the optimal amount of upfront work has shifted, not that prediction became reliable.
33
+
34
+ The model is hybrid: thorough AI-assisted exploration during ideas, followed by straightforward execution during tasks. "Lightweight" refers to task-level planning, not idea-level exploration. Invest heavily in understanding alternatives during the idea phase, then decompose into atomic tasks once the direction is clear.
35
+
36
+ ## Convergence Criteria
37
+
38
+ Exploration should continue until clear trade-offs are identified and the chosen approach can be articulated against alternatives. This is convergence-based, not time-boxed — simple ideas converge quickly, complex architectural decisions require more exploration.
39
+
40
+ When exploration feels "done":
41
+
42
+ - Multiple approaches have been considered
43
+ - Trade-offs between approaches are understood
44
+ - The chosen direction has clear justification
45
+ - Remaining uncertainty is about requirements, not design
46
+
47
+ If a task requires significant design decisions during execution, it wasn't ready to be a task.
48
+
49
+ ## Documenting Alternatives
50
+
51
+ Ideas should document the alternatives considered and why they were ruled out. This creates a decision log that helps future agents and humans understand context. Include alternatives in the idea body or Open Questions sections.
52
+
53
+ ## Parent Principle
54
+
55
+ - [Lightweight Planning](lightweight-planning.md)
56
+
57
+ ## Sub-Principles
58
+
59
+ - (none)
60
+ `
61
+ },
62
+ {
63
+ slug: "design-for-testability",
64
+ content: `# Design for Testability
65
+
66
+ Design code to be testable first; good structure follows naturally.
67
+
68
+ Testability should be a primary design driver, not a quality to be retrofitted. When code is designed to be testable from the start, it naturally becomes decoupled, explicit in its dependencies, and clear in its interfaces.
69
+
70
+ The discipline of testability forces good design: functions become pure, dependencies become explicit, side effects become isolated. Rather than viewing testability as a tax on production code, recognize it as a compass that points toward better architecture.
71
+
72
+ This is particularly important in agent-driven development. Agents cannot manually verify their changes—they rely entirely on tests. Code that resists testing resists autonomous modification.
73
+
74
+ ## Parent Principle
75
+
76
+ - [Decoupled Code](decoupled-code.md)
77
+
78
+ ## Sub-Principles
79
+
80
+ - (none)
81
+ `
82
+ },
83
+ {
84
+ slug: "readable-test-data",
85
+ content: `# Readable Test Data
86
+
87
+ Test data setup should use natural structures that mirror what they represent.
88
+
89
+ ## Why it matters
90
+
91
+ When test data is easy to read, tests become self-documenting. A file system hierarchy expressed as a nested object immediately conveys structure, while a flat Map with path strings requires mental parsing to understand the relationships.
92
+
93
+ ## In practice
94
+
95
+ Prefer literal structures that visually match the domain:
96
+
97
+ \`\`\`javascript
98
+ // Avoid: flat paths that obscure hierarchy
99
+ const fs = createFileSystemEmulator({
100
+ files: new Map([['/project/.dust/principles/my-goal.md', '# My Goal']]),
101
+ existingPaths: new Set(['/project/.dust/ideas']),
102
+ })
103
+
104
+ // Prefer: nested object that mirrors file system structure
105
+ const fs = createFileSystemEmulator({
106
+ project: {
107
+ '.dust': {
108
+ principles: {
109
+ 'my-goal.md': '# My Goal'
110
+ },
111
+ ideas: {}
112
+ }
113
+ }
114
+ })
115
+ \`\`\`
116
+
117
+ The nested form:
118
+ - Shows parent-child relationships through indentation
119
+ - Makes empty directories explicit with empty objects
120
+ - Requires no mental path concatenation to understand structure
121
+
122
+ ## How to evaluate
123
+
124
+ Work supports this principle when test setup data uses structures that visually resemble what they represent, reducing cognitive load for readers.
125
+
126
+ ## Parent Principle
127
+
128
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
129
+
130
+ ## Sub-Principles
131
+
132
+ - (none)
133
+ `
134
+ },
135
+ {
136
+ slug: "agent-specific-enhancement",
137
+ content: `# Agent-Specific Enhancement
138
+
139
+ Dust should detect and enhance the experience for specific agents while remaining agnostic at its core.
140
+
141
+ While Dust has [Agent-Agnostic Design](agent-agnostic-design.md) and works with any capable agent, it can still optimize the "agent DX" (developer experience) when it detects a specific agent is being used. This means:
142
+
143
+ - **Detection** - Dust may detect which agent is running (e.g., Claude Code, Aider, Cursor) through environment variables, configuration, or other signals
144
+ - **Enhancement** - Once detected, Dust can tailor its output format, prompts, or context to leverage that agent's specific strengths
145
+ - **Graceful fallback** - When no specific agent is detected, Dust provides a generic experience that works with any agent
146
+
147
+ This principle complements Agent-Agnostic Design: the core functionality never requires a specific agent, but the experience improves when one is recognized.
148
+
149
+ ## Applicability
150
+
151
+ Internal
152
+
153
+ ## Parent Principle
154
+
155
+ - [Agent Autonomy](agent-autonomy.md)
156
+
157
+ ## Sub-Principles
158
+
159
+ - (none)
160
+ `
161
+ },
162
+ {
163
+ slug: "context-optimised-code",
164
+ content: `# Context-Optimised Code
165
+
166
+ Code should be structured so that agents can understand and modify it within their context window constraints.
167
+
168
+ Large files, deeply nested abstractions, and sprawling dependency chains all work against agents. A 3,000-line file cannot be fully loaded into context. A function that requires understanding six levels of indirection demands more context than one that is self-contained. Context-optimised code favours small files, shallow abstractions, explicit dependencies, and co-located related logic.
169
+
170
+ Dust should help projects identify files that are too large, modules that are too tangled, and patterns that make agent comprehension harder than it needs to be. This is not just about file size — it is about ensuring that the unit of code an agent needs to understand fits comfortably within the window available.
171
+
172
+ ## Parent Principle
173
+
174
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
175
+
176
+ ## Sub-Principles
177
+
178
+ - (none)
179
+ `
180
+ },
181
+ {
182
+ slug: "self-diagnosing-tests",
183
+ content: `# Self-Diagnosing Tests
184
+
185
+ When a big test fails, it should be self-evident how to diagnose and fix the failure.
186
+
187
+ The more moving parts a test has — end-to-end, system, integration — the more critical this becomes. A test that fails with \`expected true, received false\` forces the developer (or agent) to re-run, add logging, and guess. A test that fails with a rich diff showing the actual state versus the expected state turns diagnosis into reading.
188
+
189
+ ## Anti-patterns
190
+
191
+ **Boolean flattening** — collapsing a rich value into true/false before asserting:
192
+ \`\`\`javascript
193
+ // Bad: "expected true, received false" — what events arrived?
194
+ expect(events.some(e => e.type === 'check-passed')).toBe(true)
195
+
196
+ // Good: shows the actual event types on failure
197
+ expect(events.map(e => e.type)).toContain('check-passed')
198
+ \`\`\`
199
+
200
+ **Length-only assertions** — checking count without showing contents:
201
+ \`\`\`javascript
202
+ // Bad: "expected 2, received 0" — what requests were captured?
203
+ expect(requests.length).toBe(2)
204
+
205
+ // Good: shows the actual requests on failure
206
+ expect(requests).toHaveLength(2) // vitest shows the array
207
+ \`\`\`
208
+
209
+ **Silent guards** — using \`if\` where an assertion belongs:
210
+ \`\`\`javascript
211
+ // Bad: silently passes when settings is undefined
212
+ if (settings) {
213
+ expect(JSON.parse(settings).key).toBeDefined()
214
+ }
215
+
216
+ // Good: fails explicitly if settings is missing
217
+ expect(settings).toBeDefined()
218
+ const parsed = JSON.parse(settings!)
219
+ expect(parsed.key).toBeDefined()
220
+ \`\`\`
221
+
222
+ ## The test
223
+
224
+ If a test fails, can a developer who has never seen the code identify the problem from the failure output alone — without re-running, adding console.logs, or reading the test source? The closer to "yes", the better.
225
+
226
+ ## How to evaluate
227
+
228
+ Work supports this principle when every assertion in a system or integration test would, on failure, reveal the actual state richly enough to guide a fix. Bare boolean checks, length-only assertions, and silent conditional guards are violations.
229
+
230
+ ## Parent Principle
231
+
232
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
233
+
234
+ ## Sub-Principles
235
+
236
+ - (none)
237
+ `
238
+ },
239
+ {
240
+ slug: "ideal-agent-developer-experience",
241
+ content: `# Ideal Agent Developer Experience
242
+
243
+ The agent is the developer. The human is the CEO. Dust is the PM.
244
+
245
+ With today's AI coding assistants, the human is stuck in a tight loop with agents — constantly directing, reviewing, and course-correcting. Dust is designed to relieve humans from this tight loop. Like an assistant to a CEO, dust predominantly brings fully-researched questions and well-prepared work to the human, rather than expecting the human to drive every decision. The human checks in less frequently, and when they do, they make high-leverage strategic calls rather than micromanaging implementation.
246
+
247
+ For this to work, the agent's development environment must be excellent. The agent reads the code, writes changes, runs the checks, and iterates until the task is done. Everything about the codebase and its tooling either helps or hinders that process. Comprehensive tests are the agent's only way to verify correctness. Fast feedback loops are the agent's iteration speed. Structured logs are the agent's eyes into runtime behaviour. Small, well-organised files are what fit in the agent's context window. Exploratory and debugging tools are how the agent navigates and diagnoses without trial and error.
248
+
249
+ Each sub-principle represents a different aspect of the ideal agent developer setup. The better these are, the less the human needs to be in the loop.
250
+
251
+ ## Parent Principle
252
+
253
+ - [Human-AI Collaboration](human-ai-collaboration.md)
254
+
255
+ ## Sub-Principles
256
+
257
+ - [Comprehensive Test Coverage](comprehensive-test-coverage.md)
258
+ - [Fast Feedback Loops](fast-feedback-loops.md)
259
+ - [Slow Feedback Coping](slow-feedback-coping.md)
260
+ - [Development Traceability](development-traceability.md)
261
+ - [Context-Optimised Code](context-optimised-code.md)
262
+ - [Exploratory Tooling](exploratory-tooling.md)
263
+ - [Debugging Tooling](debugging-tooling.md)
264
+ - [Self-Contained Repository](self-contained-repository.md)
265
+ `
266
+ },
267
+ {
268
+ slug: "broken-windows",
269
+ content: `# Broken Windows
270
+
271
+ Don't leave broken windows unrepaired.
272
+
273
+ A broken window — a bad name, a hack, a TODO that lingers, a test that's been skipped — signals that nobody cares. That signal invites more neglect. One shortcut becomes two, then ten, and the codebase quietly rots from the inside.
274
+
275
+ When you spot a broken window, fix it immediately if the fix is small. If it's too large, capture it as a task so it doesn't get forgotten. The key is to never normalise the damage. Even a comment acknowledging the problem ("this needs fixing because...") is better than silent acceptance.
276
+
277
+ This principle complements the [Boy Scout Rule](boy-scout-rule.md): the Boy Scout Rule encourages proactive improvement, while Broken Windows warns against tolerating known problems. Together they keep entropy at bay.
278
+
279
+ ## Parent Principle
280
+
281
+ - [Maintainable Codebase](maintainable-codebase.md)
282
+
283
+ ## Sub-Principles
284
+
285
+ - (none)
286
+ `
287
+ },
288
+ {
289
+ slug: "progressive-disclosure",
290
+ content: `# Progressive Disclosure
291
+
292
+ Dust should reveal details progressively as a way of achieving context window efficiency.
293
+
294
+ Not all information is needed at once. A task list showing just titles is sufficient for choosing what to work on. Full task details are only needed when actively implementing. Linked principles and facts can be followed when deeper context is required.
295
+
296
+ This layered approach keeps initial reads lightweight while preserving access to complete information when needed.
297
+
298
+ ## Parent Principle
299
+
300
+ - [Context Window Efficiency](context-window-efficiency.md)
301
+
302
+ ## Sub-Principles
303
+
304
+ - (none)
305
+ `
306
+ },
307
+ {
308
+ slug: "lightweight-planning",
309
+ content: `# Lightweight Planning
310
+
311
+ Dust aims to be a minimal, low-overhead planning system that stays relevant over time.
312
+
313
+ Planning artifacts are simple markdown files that live alongside code. Ideas are intentionally vague until implementation is imminent. Tasks are small and completable in single commits. Facts document current reality rather than aspirational states.
314
+
315
+ The system avoids the staleness problem by deferring detail until the last responsible moment and deleting completed work rather than archiving it.
316
+
317
+ ## Parent Principle
318
+
319
+ - [Human-AI Collaboration](human-ai-collaboration.md)
320
+
321
+ ## Sub-Principles
322
+
323
+ - [Task-First Workflow](task-first-workflow.md)
324
+ - [Some Big Design Up Front](some-big-design-up-front.md)
325
+ `
326
+ },
327
+ {
328
+ slug: "comprehensive-test-coverage",
329
+ content: `# Comprehensive Test Coverage
330
+
331
+ A project's test suite is its primary safety net, and agents depend on it even more than humans do.
332
+
333
+ Agents cannot manually verify that their changes work. They rely entirely on automated tests to confirm correctness. Gaps in test coverage become gaps in agent capability — areas where changes are risky and feedback is absent. Comprehensive coverage means every meaningful behaviour is tested, so agents can make changes anywhere in the codebase with confidence.
334
+
335
+ Dust should help projects measure and improve their test coverage, flag untested areas, and encourage a culture where new code comes with new tests.
336
+
337
+ ## Parent Principle
338
+
339
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
340
+
341
+ ## Sub-Principles
342
+
343
+ - (none)
344
+ `
345
+ },
346
+ {
347
+ slug: "intuitive-directory-structure",
348
+ content: `# Intuitive Directory Structure
349
+
350
+ Code should be organized around related concerns in clearly named directories.
351
+
352
+ When files that serve similar purposes are grouped together, the codebase becomes easier to navigate and understand. A developer looking for "commands" should find them in a \`commands\` directory. Utilities should live with utilities. This organization reduces cognitive load and makes the project structure self-documenting.
353
+
354
+ ## Parent Principle
355
+
356
+ - [Maintainable Codebase](maintainable-codebase.md)
357
+
358
+ ## Sub-Principles
359
+
360
+ - [Co-located Tests](co-located-tests.md)
361
+ `
362
+ },
363
+ {
364
+ slug: "small-units",
365
+ content: `# Small Units
366
+
367
+ Ideas, principles, facts, and tasks should each be as discrete and fine-grained as possible.
368
+
369
+ Small, focused documents enable precise relationships between them. A task can link to exactly the principles it serves. A fact can describe one specific aspect of the system. This granularity reduces ambiguity.
370
+
371
+ Tasks especially benefit from being small. A narrowly scoped task gives agents or humans the best chance of delivering exactly what was intended, in a single atomic commit.
372
+
373
+ Note: This principle directly supports [Lightweight Planning](lightweight-planning.md), which explicitly mentions that "Tasks are small and completable in single commits."
374
+
375
+ ## Parent Principle
376
+
377
+ - [Agent Autonomy](agent-autonomy.md)
378
+
379
+ ## Sub-Principles
380
+
381
+ - (none)
382
+ `
383
+ },
384
+ {
385
+ slug: "fast-feedback",
386
+ content: `# Fast Feedback
387
+
388
+ Dust should provide fast feedback loops for developers.
389
+
390
+ Scripts and tooling should execute quickly so developers can iterate rapidly. Slow feedback discourages frequent validation and leads to larger, riskier changes. Fast feedback enables small, confident steps.
391
+
392
+ ## Parent Principle
393
+
394
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
395
+
396
+ ## Sub-Principles
397
+
398
+ - (none)
399
+ `
400
+ },
401
+ {
402
+ slug: "dependency-injection",
403
+ content: `# Dependency Injection
404
+
405
+ Avoid global mocks. Dependency injection is almost always preferable to testing code that depends directly on globals.
406
+
407
+ When code depends on global state or singletons, testing requires mocking those globals—which introduces hidden coupling, complicates test setup, and risks interference between tests. Dependency injection makes dependencies explicit: they're passed in as arguments, making the code's requirements visible and enabling tests to supply controlled implementations.
408
+
409
+ This approach improves testability (each test controls its own dependencies), readability (dependencies are declared upfront), and flexibility (swapping implementations doesn't require changing the consuming code). It also makes refactoring safer since dependencies are explicit rather than implicit.
410
+
411
+ ## Parent Principle
412
+
413
+ - [Decoupled Code](decoupled-code.md)
414
+
415
+ ## Sub-Principles
416
+
417
+ - (none)
418
+ `
419
+ },
420
+ {
421
+ slug: "reproducible-checks",
422
+ content: `# Reproducible Checks
423
+
424
+ Every check must produce the same result regardless of who runs it, when, or on what machine. If a check passes for one developer but fails for another, the check is broken.
425
+
426
+ Concretely, checks should pin their tool versions via the project's dependency manager (e.g. \`devDependencies\`) rather than relying on \`npx\`/\`bunx\` to fetch the latest version at runtime. Unpinned versions introduce non-determinism — a check that passed yesterday may fail today due to a tool upgrade that nobody chose to adopt.
427
+
428
+ ## Parent Principle
429
+
430
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
431
+
432
+ ## Sub-Principles
433
+
434
+ - (none)
435
+ `
436
+ },
437
+ {
438
+ slug: "slow-feedback-coping",
439
+ content: `# Slow Feedback Coping
440
+
441
+ Some feedback is unavoidably slow — dust should offer coping strategies rather than pretending it can be eliminated.
442
+
443
+ Integration tests, end-to-end tests, deployment pipelines, and external API calls all take time. Pretending they can be made instant is unrealistic. Instead, dust should help developers and agents cope with slow feedback effectively: by structuring work so that fast checks catch most problems early, by batching slow checks intelligently, by providing clear progress indicators, and by ensuring that when slow feedback does arrive, it is actionable and specific.
444
+
445
+ Strategies include separating fast and slow test suites, running slow checks asynchronously or in CI, caching expensive operations, and designing workflows that minimise how often slow feedback is needed.
446
+
447
+ ## Parent Principle
448
+
449
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
450
+
451
+ ## Sub-Principles
452
+
453
+ - (none)
454
+ `
455
+ },
456
+ {
457
+ slug: "make-changes-with-confidence",
458
+ content: `# Make Changes with Confidence
459
+
460
+ Developers should be able to modify code without fear of breaking existing behavior.
461
+
462
+ Tests, type checking, and other automated verification enable safe refactoring and evolution of the codebase. When changes break something, fast feedback identifies the problem before it spreads. This confidence encourages continuous improvement rather than fragile, stagnant code.
463
+
464
+ ## Parent Principle
465
+
466
+ - [Maintainable Codebase](maintainable-codebase.md)
467
+
468
+ ## Sub-Principles
469
+
470
+ - [Comprehensive Assertions](comprehensive-assertions.md)
471
+ - [Decoupled Code](decoupled-code.md)
472
+ - [Fast Feedback](fast-feedback.md)
473
+ - [Lint Everything](lint-everything.md)
474
+ - [Readable Test Data](readable-test-data.md)
475
+ - [Reproducible Checks](reproducible-checks.md)
476
+ - [Stop the Line](stop-the-line.md)
477
+ - [Keep Unit Tests Pure](keep-unit-tests-pure.md)
478
+ - [Test Isolation](test-isolation.md)
479
+ - [Self-Diagnosing Tests](self-diagnosing-tests.md)
480
+ - [Unit Test Coverage](unit-test-coverage.md)
481
+ `
482
+ },
483
+ {
484
+ slug: "test-isolation",
485
+ content: `# Test Isolation
486
+
487
+ Tests should not interfere with one another. Each test must be independently runnable and produce the same result regardless of execution order or which other tests run alongside it.
488
+
489
+ This means:
490
+ - No shared mutable state between tests
491
+ - No reliance on test execution order
492
+ - No file system or environment pollution
493
+ - Each test sets up its own dependencies
494
+
495
+ Test isolation enables parallel execution, makes failures easier to diagnose, and prevents cascading false failures when one test breaks.
496
+
497
+ ## Parent Principle
498
+
499
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
500
+
501
+ ## Sub-Principles
502
+
503
+ - [Environment-Independent Tests](environment-independent-tests.md)
504
+ `
505
+ },
506
+ {
507
+ slug: "repository-hygiene",
508
+ content: `# Repository Hygiene
509
+
510
+ Dust repositories should maintain a clean, organized state with minimal noise.
511
+
512
+ This includes proper gitignore configuration to exclude build artifacts, dependencies, editor files, and other generated content from version control. A well-maintained repository makes it easier for both humans and AI to navigate and understand the codebase.
513
+
514
+ ## Parent Principle
515
+
516
+ - [Maintainable Codebase](maintainable-codebase.md)
517
+
518
+ ## Sub-Principles
519
+
520
+ - [Atomic Commits](atomic-commits.md)
521
+ - [Trunk-Based Development](trunk-based-development.md)
522
+ `
523
+ },
524
+ {
525
+ slug: "agentic-flow-state",
526
+ content: `# Agentic Flow State
527
+
528
+ Flow is the mental state where work becomes effortless - where you're fully immersed, losing track of time, operating at peak performance. Psychologist Mihaly Csikszentmihalyi identified three conditions that create flow: clear goals, immediate feedback, and challenge-skill balance.
529
+
530
+ For AI agents, achieving flow state means staying engaged and productive without interruption. Agents enter flow when they have optimal context, comprehensive guard rails, and minimal friction. Context window optimization ensures agents have exactly what they need without cognitive overload. In-session guard rails prevent agents from straying off course or making mistakes that break their momentum.
531
+
532
+ Dust's design targets these conditions directly:
533
+
534
+ - **Clear goals**: Task files and lightweight planning give you a concrete target. You know exactly what you're building next.
535
+ - **Immediate feedback**: Fast feedback loops let you see results quickly. Each change confirms you're on track or shows you what to adjust.
536
+ - **Challenge-skill balance**: Small units of work and agent autonomy keep you in the zone - challenged enough to stay engaged, supported enough to succeed.
537
+ - **Context window efficiency**: Progressive disclosure and artifact summarization ensure agents have the right context without overflow.
538
+ - **Comprehensive guard rails**: Lint rules, type checks, and automated validation catch mistakes before they compound.
539
+
540
+ Everything dust does serves flow. When agents stay in flow, they produce better work, sustain their momentum, and complete tasks autonomously.
541
+
542
+ ## Parent Principle
543
+
544
+ - (none)
545
+
546
+ ## Sub-Principles
547
+
548
+ - [Human-AI Collaboration](human-ai-collaboration.md)
549
+ - [Maintainable Codebase](maintainable-codebase.md)
550
+ `
551
+ },
552
+ {
553
+ slug: "stop-the-line",
554
+ content: `# Stop the Line
555
+
556
+ Any worker — human or agent — should halt and fix a problem the moment they detect it, rather than letting defects propagate downstream.
557
+
558
+ Originating from the Toyota production system, "Stop the Line" empowers every participant to pause work immediately upon identifying a defect, failing check, or safety hazard. Problems are cheaper to fix at their source than after they've compounded through later stages. In the context of dust, this means agents and humans alike should treat broken checks, test failures, and lint errors as blockers that demand immediate attention — not warnings to be deferred.
559
+
560
+ ## Parent Principle
561
+
562
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
563
+
564
+ ## Sub-Principles
565
+
566
+ - (none)
567
+ `
568
+ },
569
+ {
570
+ slug: "agent-context-inference",
571
+ content: `# Agent Context Inference
572
+
573
+ Terse human prompts should trigger the correct agent action.
574
+
575
+ When a human gives a brief instruction like "the button should be green", the agent should be able to infer what to do. The agent shouldn't require the human to specify file paths, component names, or implementation details that can be discovered from the repository.
576
+
577
+ This reduces friction for humans and makes agent interactions feel more natural. The burden of context discovery shifts to the agent, which can use dust's CLI and repository structure to find what it needs.
578
+
579
+ ## Applicability
580
+
581
+ Internal
582
+
583
+ ## Parent Principle
584
+
585
+ - [Agent Autonomy](agent-autonomy.md)
586
+
587
+ ## Sub-Principles
588
+
589
+ - (none)
590
+ `
591
+ },
592
+ {
593
+ slug: "naming-matters",
594
+ content: `# Naming Matters
595
+
596
+ Good naming reduces waste by eliminating confusion and making code self-documenting.
597
+
598
+ Poor names cause rework, bugs, and communication overhead. When names don't clearly convey meaning, developers waste time deciphering code, misunderstand intentions, and introduce defects. Well-chosen names serve as documentation that never goes stale, reducing the need for explanatory comments and enabling both humans and AI agents to navigate the codebase efficiently.
599
+
600
+ ## Parent Principle
601
+
602
+ - [Maintainable Codebase](maintainable-codebase.md)
603
+
604
+ ## Sub-Principles
605
+
606
+ - [Consistent Naming](consistent-naming.md)
607
+ - [Clarity Over Brevity](clarity-over-brevity.md)
608
+ `
609
+ },
610
+ {
611
+ slug: "stubs-over-mocks",
612
+ content: `# Stubs Over Mocks
613
+
614
+ Prefer hand-rolled stubs over mocks, in unit tests. Stubs keep tests focused on observable behavior instead of implementation details.
615
+
616
+ Mocks tend to encode a script of “expected calls” (what was invoked, in what order, with what arguments). That makes tests brittle: harmless refactors (changing internal decomposition, adding caching, batching calls, reordering operations) can break tests even when the externally visible behavior is unchanged. You end up maintaining tests that police how the code works rather than what it does.
617
+
618
+ Stubs (and especially in-memory emulators) push tests toward the contract: provide inputs, run the code, assert outputs and side effects. When a test fails, it’s usually because a behavior changed, not because the internal call choreography shifted. That improves signal-to-noise, reduces rewrites during refactors, and makes it easier to evolve the implementation.
619
+
620
+ For external dependencies (databases, queues, object stores, HTTP services), the default choice should be an in-memory emulator: a drop-in replacement that is faithful enough to the real interface/semantics but runs entirely in-process. It gives most of the benefits of integration testing—realistic state transitions, error modes, concurrency behavior where relevant—without the cost, flakiness, and setup burden of booting real infrastructure. It also keeps the test environment hermetic (no network, no shared state), which improves determinism and makes tests fast.
621
+
622
+ Still use mocks selectively—mainly to assert something is called (e.g., telemetry emission, "at most once" notifications, payment capture guarded by a feature flag) or when a dependency is impossible to emulate. But for most cases, stubs and in-memory emulators produce tests that are clearer, more resilient to refactoring, and better aligned with the system's actual contracts.
623
+
624
+ ## Parent Principle
625
+
626
+ - [Decoupled Code](decoupled-code.md)
627
+
628
+ ## Sub-Principles
629
+
630
+ - (none)
631
+ `
632
+ },
633
+ {
634
+ slug: "functional-core-imperative-shell",
635
+ content: `# Functional Core, Imperative Shell
636
+
637
+ Separate code into a pure "functional core" and a thin "imperative shell." The core takes values in and returns values out, with no side effects. The shell handles I/O and wires things together.
638
+
639
+ Purely functional code makes some things easier to understand: because values don't change, you can call functions and know that only their return value matters—they don't change anything outside themselves.
640
+
641
+ The functional core contains business logic as pure functions that take values and return values. The imperative shell sits at the boundary, reading input, calling into the core, and performing side effects with the results. This keeps the majority of code easy to test (no mocks or stubs needed for pure functions) and makes the I/O surface area small and explicit.
642
+
643
+ ## Parent Principle
644
+
645
+ - [Decoupled Code](decoupled-code.md)
646
+
647
+ ## Sub-Principles
648
+
649
+ - (none)
650
+ `
651
+ },
652
+ {
653
+ slug: "development-traceability",
654
+ content: `# Development Traceability
655
+
656
+ Structured logging and tracing help agents understand system behaviour without resorting to ad-hoc testing cycles.
657
+
658
+ When something goes wrong, agents often resort to adding temporary log statements, running the code, reading the output, and repeating — a slow and wasteful debugging loop. Good traceability means the system already records what happened and why, through structured logs, trace IDs, and observable state. This lets agents diagnose issues by reading existing output rather than generating new experiments.
659
+
660
+ Dust should encourage projects to adopt structured logging, promote traceability as a first-class concern, and provide tools that surface relevant trace information when agents need it.
661
+
662
+ ## Applicability
663
+
664
+ Internal
665
+
666
+ ## Parent Principle
667
+
668
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
669
+
670
+ ## Sub-Principles
671
+
672
+ - (none)
673
+ `
674
+ },
675
+ {
676
+ slug: "keep-unit-tests-pure",
677
+ content: `# Keep Unit Tests Pure
678
+
679
+ Unit tests (those run very frequently as part of a tight feedback loop) should be pure and side-effect free. A test is **not** a unit test if it:
680
+
681
+ - Accesses a database
682
+ - Communicates over a network
683
+ - Touches the file system
684
+ - Cannot run concurrently with other tests
685
+ - Requires special environment setup
686
+
687
+ "Unit tests" here means tests run frequently during development — not system tests, which intentionally exercise the full stack including I/O. Pure unit tests exercise only business logic, not infrastructure.
688
+
689
+ The value of pure unit tests is that they are fast, deterministic, and isolate business logic from infrastructure concerns. When unit tests pass but integration or system tests fail, developers can immediately narrow the problem to the boundary layer — a diagnostic "binary chop" that accelerates debugging.
690
+
691
+ ## Migration Guidance
692
+
693
+ Where existing tests are impure (e.g. they spawn processes, write temporary files, or make network calls), prefer converting them to use in-memory alternatives — stubs, fakes, or dependency-injected doubles — rather than leaving them as-is. Opportunistic migration is fine; a big-bang rewrite is not required.
694
+
695
+ ## Parent Principle
696
+
697
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
698
+
699
+ ## Sub-Principles
700
+
701
+ - (none)
702
+ `
703
+ },
704
+ {
705
+ slug: "co-located-tests",
706
+ content: `# Co-located Tests
707
+
708
+ Test files should live next to the code they test.
709
+
710
+ When tests are co-located with their source files, developers can immediately see what's tested and what isn't. Finding the test for a module becomes trivial—it's right there in the same directory. This proximity encourages writing tests as part of the development flow rather than as an afterthought, and makes it natural to update tests when modifying code.
711
+
712
+ ## Parent Principle
713
+
714
+ - [Intuitive Directory Structure](intuitive-directory-structure.md)
715
+
716
+ ## Sub-Principles
717
+
718
+ - (none)
719
+ `
720
+ },
721
+ {
722
+ slug: "human-ai-collaboration",
723
+ content: `# Human-AI Collaboration
724
+
725
+ Dust exists to enable effective collaboration between humans and AI agents on complex projects.
726
+
727
+ The human is the CEO — they set direction, make strategic decisions, and check in when it matters. Dust is the PM — it manages the work, prepares context, and brings fully-researched questions to the human rather than expecting them to drive every detail. Agents are the developers — they read code, write changes, and iterate autonomously.
728
+
729
+ Today's AI coding tools keep humans in a tight loop with agents. Dust is designed to loosen that loop, so humans spend less time directing and more time deciding.
730
+
731
+ ## Parent Principle
732
+
733
+ - [Agentic Flow State](agentic-flow-state.md)
734
+
735
+ ## Sub-Principles
736
+
737
+ - [Agent Autonomy](agent-autonomy.md)
738
+ - [Easy Adoption](easy-adoption.md)
739
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
740
+ - [Lightweight Planning](lightweight-planning.md)
741
+ `
742
+ },
743
+ {
744
+ slug: "vcs-independence",
745
+ content: `# VCS Independence
746
+
747
+ Dust should work independently of any specific version control system.
748
+
749
+ While git is common, dust's core functionality should not require git. This enables use in repositories using other VCS (Mercurial, SVN, Perforce) or in non-VCS workflows.
750
+
751
+ ## Parent Principle
752
+
753
+ - [Easy Adoption](easy-adoption.md)
754
+
755
+ ## Sub-Principles
756
+
757
+ - (none)
758
+ `
759
+ },
760
+ {
761
+ slug: "environment-independent-tests",
762
+ content: `# Environment-Independent Tests
763
+
764
+ Tests must produce the same result regardless of where they run. A test that passes locally but fails in CI (or vice versa) is a broken test.
765
+
766
+ Concretely, tests should never depend on:
767
+ - Ambient environment variables (e.g. \`CLAUDECODE\`, \`CI\`, \`HOME\`)
768
+ - The current working directory or filesystem layout of the host machine
769
+ - Network availability or external services
770
+ - The identity of the user or agent running the tests
771
+
772
+ When a function's behavior depends on environment variables, the test must explicitly control those variables (via \`stubEnv\`, dependency injection, or passing an \`env\` parameter) rather than relying on whatever happens to be set in the current shell.
773
+
774
+ ## Parent Principle
775
+
776
+ - [Test Isolation](test-isolation.md)
777
+
778
+ ## Sub-Principles
779
+
780
+ - (none)
781
+ `
782
+ },
783
+ {
784
+ slug: "debugging-tooling",
785
+ content: `# Debugging Tooling
786
+
787
+ Agents need effective tools for diagnosing and fixing issues without manual intervention.
788
+
789
+ Traditional debugging relies on breakpoints, stepping through code, and interactive inspection — techniques that work well for humans but poorly for agents. Agents need debugging tools that produce readable, structured output: stack traces with context, diff-friendly error messages, reproducible test cases, and diagnostic commands that can be run non-interactively.
790
+
791
+ Dust should help projects adopt agent-friendly debugging practices: structured error output, diagnostic scripts, snapshot testing for complex state, and tools that turn vague symptoms into specific, actionable information.
792
+
793
+ ## Applicability
794
+
795
+ Internal
796
+
797
+ ## Parent Principle
798
+
799
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
800
+
801
+ ## Sub-Principles
802
+
803
+ - (none)
804
+ `
805
+ },
806
+ {
807
+ slug: "atomic-commits",
808
+ content: `# Atomic Commits
809
+
810
+ Each commit should tell a complete story, bundling implementation changes with their corresponding documentation updates.
811
+
812
+ When a task is completed, the commit deletes the task file, updates relevant facts to reflect the new reality, and removes any ideas that have been realized. This discipline ensures that any point in the commit history represents a coherent, self-documenting state of the project.
813
+
814
+ Clean commit history is essential because archaeology depends on it. Future humans and AI agents will traverse history to understand why decisions were made and how the system evolved.
815
+
816
+ ## Parent Principle
817
+
818
+ - [Repository Hygiene](repository-hygiene.md)
819
+
820
+ ## Sub-Principles
821
+
822
+ - [Traceable Decisions](traceable-decisions.md)
823
+ `
824
+ },
825
+ {
826
+ slug: "trunk-based-development",
827
+ content: `# Trunk-Based Development
828
+
829
+ Dust is designed to support a non-branching workflow where developers commit directly to a single main branch.
830
+
831
+ In trunk-based development, teams collaborate on code in one primary branch rather than maintaining multiple long-lived feature branches. This eliminates merge conflicts, enables continuous integration, and keeps the codebase continuously releasable.
832
+
833
+ The \`dust loop claude\` command embodies this philosophy: agents pull from main, implement a task, and push directly back to main. There are no feature branches, no pull requests, no merge queues. Each commit is atomic and complete.
834
+
835
+ This approach scales through discipline rather than isolation. Feature flags and incremental changes replace long-running branches. The repository history becomes a linear sequence of working states.
836
+
837
+ See: https://trunkbaseddevelopment.com/
838
+
839
+ ## Parent Principle
840
+
841
+ - [Repository Hygiene](repository-hygiene.md)
842
+
843
+ ## Sub-Principles
844
+
845
+ (none)
846
+ `
847
+ },
848
+ {
849
+ slug: "comprehensive-assertions",
850
+ content: `# Comprehensive Assertions
851
+
852
+ Assert the whole, not the parts.
853
+
854
+ When you break a complex object into many small assertions, a failure tells you *one thing that's wrong*. When you assert against the whole expected value, the diff tells you *what actually happened versus what you expected* — the full picture, in one glance.
855
+
856
+ Small assertions are like yes/no questions to a witness. A whole-object assertion is like asking "tell me what you saw."
857
+
858
+ ## In practice
859
+
860
+ Collapse multiple partial assertions into one comprehensive assertion:
861
+
862
+ \`\`\`javascript
863
+ // Fragmented — each failure is a narrow keyhole
864
+ expect(result.name).toBe("Alice");
865
+ expect(result.age).toBe(30);
866
+ expect(result.role).toBe("admin");
867
+
868
+ // Whole — a failure diff tells the full story
869
+ expect(result).toEqual({
870
+ name: "Alice",
871
+ age: 30,
872
+ role: "admin",
873
+ });
874
+ \`\`\`
875
+
876
+ If \`role\` is \`"user"\` and \`age\` is \`29\`, the fragmented version stops at the first failure. The whole-object assertion shows both discrepancies at once, in context.
877
+
878
+ The same applies to arrays:
879
+
880
+ \`\`\`javascript
881
+ // Avoid: partial assertions that hide the actual state
882
+ expect(array).toContain('apples')
883
+ expect(array).toContain('oranges')
884
+
885
+ // Prefer: one assertion that reveals the full picture on failure
886
+ expect(array).toEqual(['apples', 'oranges'])
887
+ \`\`\`
888
+
889
+ ## How to evaluate
890
+
891
+ Work supports this principle when test failures tell a rich story — showing the complete actual value alongside the complete expected value, so the reader can understand what happened without re-running anything.
892
+
893
+ ## Parent Principle
894
+
895
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
896
+
897
+ ## Sub-Principles
898
+
899
+ - (none)
900
+ `
901
+ },
902
+ {
903
+ slug: "cross-platform-compatibility",
904
+ content: `# Cross-Platform Compatibility
905
+
906
+ Dust should work consistently across operating systems: Linux, macOS, and Windows.
907
+
908
+ This means:
909
+ - Avoiding platform-specific shell commands or syntax
910
+ - Using cross-platform path handling
911
+ - Testing on multiple platforms when possible
912
+ - Documenting any platform-specific limitations
913
+
914
+ Cross-platform support broadens adoption and ensures teams with mixed environments can collaborate effectively.
915
+
916
+ ## Parent Principle
917
+
918
+ - [Easy Adoption](easy-adoption.md)
919
+
920
+ ## Sub-Principles
921
+
922
+ - (none)
923
+ `
924
+ },
925
+ {
926
+ slug: "exploratory-tooling",
927
+ content: `# Exploratory Tooling
928
+
929
+ Agents need tools to efficiently explore and understand unfamiliar codebases.
930
+
931
+ When an agent encounters a new codebase — or an unfamiliar corner of a familiar one — it needs to quickly build a mental model: what exists, how it fits together, and where to make changes. Without good exploratory tools, agents waste context on trial-and-error searches, reading irrelevant files, and forming incorrect assumptions.
932
+
933
+ Dust should promote and integrate tools that help agents explore: dependency graphs, module overviews, search utilities tuned for code navigation, and summaries of project structure. The goal is to make the "orientation" phase of any task as short and reliable as possible.
934
+
935
+ ## Applicability
936
+
937
+ Internal
938
+
939
+ ## Parent Principle
940
+
941
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
942
+
943
+ ## Sub-Principles
944
+
945
+ - (none)
946
+ `
947
+ },
948
+ {
949
+ slug: "reasonably-dry",
950
+ content: `# Reasonably DRY
951
+
952
+ Don't repeat yourself is a good principle, but don't overdo it.
953
+
954
+ Extracting shared code too eagerly can create tight coupling, obscure intent, and make changes harder. When two pieces of code look similar but serve different purposes or are likely to evolve independently, duplication is the better choice. The cost of a wrong abstraction is higher than the cost of a little repetition. Extract shared code when the duplication is truly about the same concept and has proven stable, not just because two things happen to look alike right now.
955
+
956
+ ## Parent Principle
957
+
958
+ - [Maintainable Codebase](maintainable-codebase.md)
959
+
960
+ ## Sub-Principles
961
+
962
+ - (none)
963
+ `
964
+ },
965
+ {
966
+ slug: "runtime-agnostic-tests",
967
+ content: `# Runtime Agnostic Tests
968
+
969
+ Dust's test suite should work across JavaScript runtimes.
970
+
971
+ Tests should use standard JavaScript testing patterns that work across Node.js, Bun, and other runtimes. Avoiding runtime-specific test APIs ensures the project can leverage different runtimes' advantages while maintaining broad compatibility.
972
+
973
+ ## Parent Principle
974
+
975
+ - [Minimal Dependencies](minimal-dependencies.md)
976
+
977
+ ## Sub-Principles
978
+
979
+ - (none)
980
+ `
981
+ },
982
+ {
983
+ slug: "task-first-workflow",
984
+ content: `# Task-First Workflow
985
+
986
+ Work should be captured as a task before implementation begins, creating traceability between intent and outcome.
987
+
988
+ This discipline ensures that every change has a documented purpose. The commit history shows pairs of "Add task" followed by implementation, making it easy to understand why each change was made. It also prevents scope creep by defining boundaries before work starts.
989
+
990
+ ## Parent Principle
991
+
992
+ - [Lightweight Planning](lightweight-planning.md)
993
+
994
+ ## Sub-Principles
995
+
996
+ - (none)
997
+ `
998
+ },
999
+ {
1000
+ slug: "agent-autonomy",
1001
+ content: `# Agent Autonomy
1002
+
1003
+ Dust exists to enable AI agents to produce work autonomously.
1004
+
1005
+ With sufficient planning and small enough units, this works much better in practice.
1006
+
1007
+ ## Parent Principle
1008
+
1009
+ - [Human-AI Collaboration](human-ai-collaboration.md)
1010
+
1011
+ ## Sub-Principles
1012
+
1013
+ - [Actionable Errors](actionable-errors.md)
1014
+ - [Batteries Included](batteries-included.md)
1015
+ - [Agent-Agnostic Design](agent-agnostic-design.md)
1016
+ - [Agent Context Inference](agent-context-inference.md)
1017
+ - [Agent-Specific Enhancement](agent-specific-enhancement.md)
1018
+ - [Context Window Efficiency](context-window-efficiency.md)
1019
+ - [Small Units](small-units.md)
1020
+ `
1021
+ },
1022
+ {
1023
+ slug: "clarity-over-brevity",
1024
+ content: `# Clarity Over Brevity
1025
+
1026
+ Names should be descriptive and self-documenting, even if longer.
1027
+
1028
+ Abbreviated names like \`ctx\`, \`deps\`, \`fs\`, or \`args\` save a few keystrokes but obscure meaning. Full names like \`context\`, \`dependencies\`, \`fileSystem\`, and \`arguments\` make code immediately understandable without requiring readers to decode conventions. This is especially valuable when AI agents or new contributors read the codebase for the first time.
1029
+
1030
+ ## Parent Principle
1031
+
1032
+ - [Naming Matters](naming-matters.md)
1033
+
1034
+ ## Sub-Principles
1035
+
1036
+ - (none)
1037
+ `
1038
+ },
1039
+ {
1040
+ slug: "fast-feedback-loops",
1041
+ content: `# Fast Feedback Loops
1042
+
1043
+ The primary feedback loop — write code, run checks, see results — should be as fast as possible.
1044
+
1045
+ Fast feedback is the foundation of productive development, for both humans and agents. When tests, linters, and type checks run in seconds rather than minutes, developers iterate more frequently and catch problems earlier. Agents especially benefit because they operate in tight loops of change-and-verify; slow feedback wastes tokens and context window space on waiting rather than working.
1046
+
1047
+ Dust should help projects measure the speed of their feedback loops, identify bottlenecks, and keep them fast as the codebase grows. This includes promoting practices like unit tests over integration tests for speed, incremental compilation, and check parallelisation.
1048
+
1049
+ ## Parent Principle
1050
+
1051
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
1052
+
1053
+ ## Sub-Principles
1054
+
1055
+ - (none)
1056
+ `
1057
+ },
1058
+ {
1059
+ slug: "make-the-change-easy",
1060
+ content: `# Make the Change Easy
1061
+
1062
+ For each desired change, make the change easy, then make the easy change.
1063
+
1064
+ This principle, articulated by Kent Beck, recognizes that the hardest part of a change is often not the change itself but the state of the code receiving it. When code resists a change, the right response is to first refactor until the change becomes straightforward, and only then make it. The warning - "this may be hard" - acknowledges that preparing the ground takes real effort, but the result is a change that fits naturally rather than one forced in against the grain.
1065
+
1066
+ Work that supports this principle includes refactoring before feature work, improving abstractions that make a category of changes simpler, and resisting the urge to bolt changes onto code that isn't ready for them.
1067
+
1068
+ ## Parent Principle
1069
+
1070
+ - [Maintainable Codebase](maintainable-codebase.md)
1071
+
1072
+ ## Sub-Principles
1073
+
1074
+ - (none)
1075
+ `
1076
+ },
1077
+ {
1078
+ slug: "self-contained-repository",
1079
+ content: `# Self-Contained Repository
1080
+
1081
+ Where possible, developers and agents should have everything they need to be productive, within the repository.
1082
+
1083
+ No third-party tools should be required beyond those that can be installed with a single command defined in the repository. Setup instructions, scripts, configuration, and dependencies should all live in version control so that cloning the repo and running a single install command is sufficient to start working. This eliminates onboarding friction, reduces "works on my machine" issues, and is especially important for agents — who cannot browse the web to find missing tools or ask colleagues how to set things up.
1084
+
1085
+ ## Applicability
1086
+
1087
+ Internal
1088
+
1089
+ ## Parent Principle
1090
+
1091
+ - [Ideal Agent Developer Experience](ideal-agent-developer-experience.md)
1092
+
1093
+ ## Sub-Principles
1094
+
1095
+ - (none)
1096
+ `
1097
+ },
1098
+ {
1099
+ slug: "traceable-decisions",
1100
+ content: `# Traceable Decisions
1101
+
1102
+ The commit history should explain why changes were made, not just what changed.
1103
+
1104
+ Commit messages should capture intent and context that would otherwise be lost. Future maintainers (human or AI) will traverse history to understand the reasoning behind decisions. A commit that says "Fix bug" is less valuable than one that explains what was broken and why the fix is correct.
1105
+
1106
+ ## Parent Principle
1107
+
1108
+ - [Atomic Commits](atomic-commits.md)
1109
+
1110
+ ## Sub-Principles
1111
+
1112
+ - (none)
1113
+ `
1114
+ },
1115
+ {
1116
+ slug: "unit-test-coverage",
1117
+ content: `# Unit Test Coverage
1118
+
1119
+ Complete unit test coverage ensures low-level tests give users direct feedback as they change the code.
1120
+
1121
+ Excluding system tests from coverage reporting focuses attention on unit tests - the tests that provide the fastest, most specific feedback. When coverage tools only measure unit tests, developers can quickly identify which parts of the codebase lack fine-grained test protection.
1122
+
1123
+ ## Parent Principle
1124
+
1125
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
1126
+
1127
+ ## Sub-Principles
1128
+
1129
+ - (none)
1130
+ `
1131
+ },
1132
+ {
1133
+ slug: "decoupled-code",
1134
+ content: `# Decoupled Code
1135
+
1136
+ Code should be organized into independent units with explicit dependencies.
1137
+
1138
+ Decoupled code is easier to test, understand, and modify. Dependencies are passed in rather than hard-coded, enabling units to be tested in isolation and composed flexibly. This reduces the blast radius of changes and makes the system more maintainable.
1139
+
1140
+ ## Parent Principle
1141
+
1142
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
1143
+
1144
+ ## Sub-Principles
1145
+
1146
+ - [Dependency Injection](dependency-injection.md)
1147
+ - [Stubs Over Mocks](stubs-over-mocks.md)
1148
+ - [Functional Core, Imperative Shell](functional-core-imperative-shell.md)
1149
+ - [Design for Testability](design-for-testability.md)
1150
+ `
1151
+ },
1152
+ {
1153
+ slug: "lint-everything",
1154
+ content: `# Lint Everything
1155
+
1156
+ Prefer static analysis over runtime checks. Every error caught by a linter is an error that never reaches tests, and every error caught by tests is an error that never reaches production.
1157
+
1158
+ Lint markdown, lint types, lint formatting. If it can be checked statically, check it. Linters are fast, deterministic, and catch entire categories of bugs before code even runs.
1159
+
1160
+ This project lints:
1161
+ - TypeScript (type checking and style)
1162
+ - Markdown (broken links, required sections)
1163
+ - Task files (structure validation)
1164
+ - Principle hierarchy (parent/child consistency)
1165
+
1166
+ ## Parent Principle
1167
+
1168
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
1169
+
1170
+ ## Sub-Principles
1171
+
1172
+ (none)
1173
+ `
1174
+ },
1175
+ {
1176
+ slug: "maintainable-codebase",
1177
+ content: `# Maintainable Codebase
1178
+
1179
+ The dust codebase should be easy to understand, modify, and extend.
1180
+
1181
+ This principle governs how we develop and maintain dust itself, separate from the principles that describe what dust offers its users. A well-maintained codebase enables rapid iteration, reduces bugs, and makes contributions easier.
1182
+
1183
+ ## Parent Principle
1184
+
1185
+ - [Agentic Flow State](agentic-flow-state.md)
1186
+
1187
+ ## Sub-Principles
1188
+
1189
+ - [Make Changes with Confidence](make-changes-with-confidence.md)
1190
+ - [Minimal Dependencies](minimal-dependencies.md)
1191
+ - [Intuitive Directory Structure](intuitive-directory-structure.md)
1192
+ - [Repository Hygiene](repository-hygiene.md)
1193
+ - [Naming Matters](naming-matters.md)
1194
+ - [Reasonably DRY](reasonably-dry.md)
1195
+ - [Make the Change Easy](make-the-change-easy.md)
1196
+ - [Boy Scout Rule](boy-scout-rule.md)
1197
+ - [Broken Windows](broken-windows.md)
1198
+ `
1199
+ },
1200
+ {
1201
+ slug: "agent-agnostic-design",
1202
+ content: `# Agent-Agnostic Design
1203
+
1204
+ Dust should work with multiple agents without favoring one.
1205
+
1206
+ Rather than implementing agents, Dust generates prompts and context that can be passed to any capable agent. This keeps Dust lightweight and allows teams to use whatever agent tooling they prefer.
1207
+
1208
+ Dust may have built-in support for invoking popular agents (Claude, Aider, Codex, etc.), but the choice of agent should always be made by the user at runtime - never hard-coded into repository configuration.
1209
+
1210
+ Note: Supporting multiple agents directly contributes to [Easy Adoption](easy-adoption.md), since teams can use their preferred agent tools without being locked into a specific platform.
1211
+
1212
+ ## Applicability
1213
+
1214
+ Internal
1215
+
1216
+ ## Parent Principle
1217
+
1218
+ - [Agent Autonomy](agent-autonomy.md)
1219
+
1220
+ ## Sub-Principles
1221
+
1222
+ - (none)
1223
+ `
1224
+ },
1225
+ {
1226
+ slug: "easy-adoption",
1227
+ content: `# Easy Adoption
1228
+
1229
+ Dust should be trivially easy to adopt in any repository.
1230
+
1231
+ Getting started with Dust should require minimal friction. A developer should be able to bootstrap Dust in their repository with a single command, without needing to install dependencies, configure build tools, or understand the internals.
1232
+
1233
+ This lowers the barrier to entry and encourages experimentation.
1234
+
1235
+ ## Parent Principle
1236
+
1237
+ - [Human-AI Collaboration](human-ai-collaboration.md)
1238
+
1239
+ ## Sub-Principles
1240
+
1241
+ - [Cross-Platform Compatibility](cross-platform-compatibility.md)
1242
+ - [Unsurprising UX](unsurprising-ux.md)
1243
+ - [VCS Independence](vcs-independence.md)
1244
+ `
1245
+ },
1246
+ {
1247
+ slug: "actionable-errors",
1248
+ content: `# Actionable Errors
1249
+
1250
+ Error messages should tell you what to do next, not just what went wrong.
1251
+
1252
+ When something fails, the message should provide:
1253
+ - A clear description of the problem
1254
+ - Specific guidance on how to fix it
1255
+ - Context needed to take the next step
1256
+
1257
+ This is especially important for AI agents, who need concrete instructions to recover autonomously. A good error message turns a dead end into a signpost.
1258
+
1259
+ ## Parent Principle
1260
+
1261
+ - [Agent Autonomy](agent-autonomy.md)
1262
+
1263
+ ## Sub-Principles
1264
+
1265
+ - (none)
1266
+ `
1267
+ },
1268
+ {
1269
+ slug: "consistent-naming",
1270
+ content: `# Consistent Naming
1271
+
1272
+ Names should follow established conventions within each category to reduce cognitive load.
1273
+
1274
+ Principles use Title Case. File names use kebab-case. Commands use lowercase with hyphens. When naming conventions exist, follow them. When they don't, establish one and apply it consistently. Inconsistent naming creates friction for both humans and AI agents trying to predict or recall identifiers.
1275
+
1276
+ ## Parent Principle
1277
+
1278
+ - [Naming Matters](naming-matters.md)
1279
+
1280
+ ## Sub-Principles
1281
+
1282
+ - (none)
1283
+ `
1284
+ },
1285
+ {
1286
+ slug: "minimal-dependencies",
1287
+ content: `# Minimal Dependencies
1288
+
1289
+ Dust should avoid coupling to specific tools so we can switch to better alternatives as they emerge.
1290
+
1291
+ By keeping dependencies minimal and using standard APIs where possible, we maintain the freedom to adopt new tools without major rewrites. This applies to runtimes, test frameworks, build tools, and other infrastructure choices.
1292
+
1293
+ ## Parent Principle
1294
+
1295
+ - [Maintainable Codebase](maintainable-codebase.md)
1296
+
1297
+ ## Sub-Principles
1298
+
1299
+ - [Runtime Agnostic Tests](runtime-agnostic-tests.md)
1300
+ `
1301
+ },
1302
+ {
1303
+ slug: "context-window-efficiency",
1304
+ content: `# Context Window Efficiency
1305
+
1306
+ Dust should be designed with short attention spans in mind.
1307
+
1308
+ AI agents operate within limited context windows. Every token consumed by planning artifacts is a token unavailable for reasoning about code. Dust keeps artifacts concise and scannable so agents can quickly understand what needs to be done without wading through verbose documentation.
1309
+
1310
+ This means favoring brevity over completeness, using consistent structures that are fast to parse, and avoiding redundant information across files.
1311
+
1312
+ ## Parent Principle
1313
+
1314
+ - [Agent Autonomy](agent-autonomy.md)
1315
+
1316
+ ## Sub-Principles
1317
+
1318
+ - [Progressive Disclosure](progressive-disclosure.md)
1319
+ `
1320
+ },
1321
+ {
1322
+ slug: "boy-scout-rule",
1323
+ content: `# Boy Scout Rule
1324
+
1325
+ Always leave the code better than you found it.
1326
+
1327
+ When working in any area of the codebase, take the opportunity to make small improvements — clearer names, removed dead code, better structure — even if they're not directly related to the task at hand. These incremental improvements compound over time, preventing gradual decay and keeping the codebase healthy without requiring dedicated cleanup efforts.
1328
+
1329
+ The Boy Scout Rule is not a license for large-scale refactoring during unrelated work. Improvements should be small, obvious, and low-risk. If a cleanup is too large to include alongside the current task, capture it as a separate task instead.
1330
+
1331
+ ## Parent Principle
1332
+
1333
+ - [Maintainable Codebase](maintainable-codebase.md)
1334
+
1335
+ ## Sub-Principles
1336
+
1337
+ - (none)
1338
+ `
1339
+ },
1340
+ {
1341
+ slug: "unsurprising-ux",
1342
+ content: `# Unsurprising UX
1343
+
1344
+ The user interface should be as "guessable" as possible.
1345
+
1346
+ Following the [Principle of Least Astonishment](https://en.wikipedia.org/wiki/Principle_of_least_astonishment), users form expectations about how a tool will behave based on conventions, prior experience, and intuition. Dust's interface (including the CLI) should match those expectations wherever possible. If users are observed trying to use the interface in ways we didn't anticipate, the interface should be adjusted to meet their expectations — even if that means supporting many ways of achieving the same result.
1347
+
1348
+ Surprising behavior erodes trust and slows people down. Unsurprising behavior lets users stay in flow.
1349
+
1350
+ ## Parent Principle
1351
+
1352
+ - [Easy Adoption](easy-adoption.md)
1353
+
1354
+ ## Sub-Principles
1355
+
1356
+ - (none)
1357
+ `
1358
+ }
1359
+ ];
6
1360
 
7
1361
  // lib/markdown/markdown-utilities.ts
8
1362
  function extractTitle(content) {
@@ -11,57 +1365,6 @@ function extractTitle(content) {
11
1365
  }
12
1366
  var MARKDOWN_LINK_PATTERN = /\[([^\]]+)\]\(([^)]+)\)/;
13
1367
 
14
- // lib/artifacts/principles.ts
15
- function extractLinksFromSection(content, sectionHeading) {
16
- const lines = content.split(`
17
- `);
18
- const links = [];
19
- let inSection = false;
20
- for (const line of lines) {
21
- if (line.startsWith("## ")) {
22
- inSection = line.trimEnd() === `## ${sectionHeading}`;
23
- continue;
24
- }
25
- if (!inSection)
26
- continue;
27
- if (line.startsWith("# "))
28
- break;
29
- const linkMatch = line.match(MARKDOWN_LINK_PATTERN);
30
- if (linkMatch) {
31
- const target = linkMatch[2];
32
- const slugMatch = target.match(/([^/]+)\.md$/);
33
- if (slugMatch) {
34
- links.push(slugMatch[1]);
35
- }
36
- }
37
- }
38
- return links;
39
- }
40
- function extractSingleLinkFromSection(content, sectionHeading) {
41
- const links = extractLinksFromSection(content, sectionHeading);
42
- return links.length === 1 ? links[0] : null;
43
- }
44
- async function parsePrinciple(fileSystem, dustPath, slug) {
45
- const principlePath = `${dustPath}/principles/${slug}.md`;
46
- if (!fileSystem.exists(principlePath)) {
47
- throw new Error(`Principle not found: "${slug}" (expected file at ${principlePath})`);
48
- }
49
- const content = await fileSystem.readFile(principlePath);
50
- const title = extractTitle(content);
51
- if (!title) {
52
- throw new Error(`Principle file has no title: ${principlePath}`);
53
- }
54
- const parentPrinciple = extractSingleLinkFromSection(content, "Parent Principle");
55
- const subPrinciples = extractLinksFromSection(content, "Sub-Principles");
56
- return {
57
- slug,
58
- title,
59
- content,
60
- parentPrinciple,
61
- subPrinciples
62
- };
63
- }
64
-
65
1368
  // lib/artifacts/core-principles.ts
66
1369
  function sortNodes(nodes) {
67
1370
  nodes.sort((a, b) => a.title.localeCompare(b.title));
@@ -119,36 +1422,52 @@ function getCorePrincipleTree(allPrinciples, config) {
119
1422
  }
120
1423
 
121
1424
  // lib/core-principles.ts
122
- function createFileReader() {
123
- return {
124
- exists: existsSync,
125
- readFile: (path) => readFile(path, "utf-8")
126
- };
1425
+ function extractLinksFromSection(content, sectionHeading) {
1426
+ const lines = content.split(`
1427
+ `);
1428
+ const links = [];
1429
+ let inSection = false;
1430
+ for (const line of lines) {
1431
+ if (line.startsWith("## ")) {
1432
+ inSection = line.trimEnd() === `## ${sectionHeading}`;
1433
+ continue;
1434
+ }
1435
+ if (!inSection)
1436
+ continue;
1437
+ if (line.startsWith("# "))
1438
+ break;
1439
+ const linkMatch = line.match(MARKDOWN_LINK_PATTERN);
1440
+ if (linkMatch) {
1441
+ const target = linkMatch[2];
1442
+ const slugMatch = target.match(/([^/]+)\.md$/);
1443
+ if (slugMatch) {
1444
+ links.push(slugMatch[1]);
1445
+ }
1446
+ }
1447
+ }
1448
+ return links;
1449
+ }
1450
+ function extractSingleLinkFromSection(content, sectionHeading) {
1451
+ const links = extractLinksFromSection(content, sectionHeading);
1452
+ return links.length === 1 ? links[0] : null;
127
1453
  }
128
- function locatePackagePrinciplesDir() {
129
- const thisFile = fileURLToPath(import.meta.url);
130
- const thisDir = dirname(thisFile);
131
- const packageRoot = dirname(thisDir);
132
- const principlesDir = join(packageRoot, ".dust", "principles");
133
- if (!existsSync(principlesDir)) {
134
- throw new Error(`Core principles directory not found at ${principlesDir}. ` + "Ensure the @joshski/dust package is properly installed.");
1454
+ function parsePrincipleContent(slug, content) {
1455
+ const title = extractTitle(content);
1456
+ if (!title) {
1457
+ throw new Error(`Principle has no title: ${slug}`);
135
1458
  }
136
- return principlesDir;
1459
+ const parentPrinciple = extractSingleLinkFromSection(content, "Parent Principle");
1460
+ const subPrinciples = extractLinksFromSection(content, "Sub-Principles");
1461
+ return {
1462
+ slug,
1463
+ title,
1464
+ content,
1465
+ parentPrinciple,
1466
+ subPrinciples
1467
+ };
137
1468
  }
138
1469
  async function readAllCorePrinciples() {
139
- const principlesDir = locatePackagePrinciplesDir();
140
- const packageRoot = dirname(dirname(principlesDir));
141
- const dustPath = join(packageRoot, ".dust");
142
- const fileSystem = createFileReader();
143
- const files = readdirSync(principlesDir);
144
- const mdFiles = files.filter((f) => f.endsWith(".md"));
145
- const principles = [];
146
- for (const file of mdFiles) {
147
- const slug = file.replace(/\.md$/, "");
148
- const principle = await parsePrinciple(fileSystem, dustPath, slug);
149
- principles.push(principle);
150
- }
151
- return principles;
1470
+ return BUNDLED_PRINCIPLES.map(({ slug, content }) => parsePrincipleContent(slug, content));
152
1471
  }
153
1472
  async function getCorePrincipleSlugs(config = {}) {
154
1473
  const allPrinciples = await readAllCorePrinciples();
@@ -158,15 +1477,10 @@ async function getCorePrincipleHierarchy(config = {}) {
158
1477
  const allPrinciples = await readAllCorePrinciples();
159
1478
  return getCorePrincipleTree(allPrinciples, config);
160
1479
  }
161
- function getCorePrinciplesPath() {
162
- const principlesDir = locatePackagePrinciplesDir();
163
- return `${principlesDir}/`;
164
- }
165
1480
  export {
166
1481
  readAllCorePrinciples,
167
1482
  listCorePrinciples,
168
1483
  isInternalPrinciple,
169
- getCorePrinciplesPath,
170
1484
  getCorePrincipleTree,
171
1485
  getCorePrincipleSlugs,
172
1486
  getCorePrincipleHierarchy