lgtm-specs 0.0.4 → 0.0.5

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 (53) hide show
  1. package/AGENTS.md +7 -3
  2. package/VERSION +1 -1
  3. package/agents/modes/build.md +43 -12
  4. package/agents/roles/lead.md +15 -7
  5. package/contribute/README.md +1 -0
  6. package/contribute/checklist.md +8 -4
  7. package/contribute/verification.md +122 -0
  8. package/docs/meta/industry_best_practices.md +28 -10
  9. package/integrate/README.md +49 -444
  10. package/integrate/agent_builder.md +137 -0
  11. package/integrate/artifacts.md +87 -0
  12. package/integrate/context_injection.md +19 -0
  13. package/integrate/context_limits.md +156 -0
  14. package/integrate/counsel_contract.md +65 -0
  15. package/integrate/example_flow.md +24 -0
  16. package/integrate/model_resolver.md +56 -0
  17. package/integrate/versioning.md +22 -6
  18. package/package.json +30 -3
  19. package/rules/RULE-00000-EXAMPLE.md +1 -1
  20. package/rules/constitution/CONS-00008-composition.md +1 -1
  21. package/rules/constitution/CONS-00030-rework-cycle.md +4 -2
  22. package/rules/constitution/CONS-00031-checklist.md +10 -2
  23. package/rules/laws/bitcoin/BTC-00007-dust-policy.md +1 -1
  24. package/rules/laws/bitcoin/BTC-00008-min-relay-fee.md +1 -1
  25. package/rules/laws/bitcoin/BTC-00009-feefilter.md +1 -1
  26. package/rules/laws/git/GIT-00001-atomic-commit.md +13 -3
  27. package/rules/laws/git/GIT-00021-partial-staging.md +1 -1
  28. package/rules/laws/git/GIT-00024-dependency-management.md +15 -11
  29. package/rules/laws/git/GIT-00025-large-repository-optimization.md +1 -1
  30. package/rules/laws/go/GO-00009-table-driven-test.md +1 -1
  31. package/rules/laws/go/GO-00015-aaa-pattern.md +1 -1
  32. package/rules/laws/go/GO-00016-test-libraries.md +1 -1
  33. package/rules/laws/go/GO-00017-comments.md +1 -1
  34. package/rules/laws/go/GO-00018-test-isolation.md +1 -1
  35. package/rules/laws/go/GO-00020-mocking.md +1 -1
  36. package/rules/laws/go/GO-00021-configuration.md +1 -1
  37. package/rules/laws/go/GO-00023-dependency-management.md +1 -1
  38. package/rules/laws/go/GO-00024-project-layout.md +1 -1
  39. package/rules/laws/go/GO-00025-concurrency-patterns.md +1 -1
  40. package/rules/laws/typescript/TS-00006-interface.md +1 -1
  41. package/rules/laws/typescript/TS-00008-modules.md +1 -1
  42. package/scripts/README.md +8 -1
  43. package/scripts/test_validate_specs.py +127 -0
  44. package/scripts/validate_specs.py +159 -13
  45. package/.claude/settings.local.json +0 -14
  46. package/.gemini/README.md +0 -8
  47. package/.gemini/config.yaml +0 -20
  48. package/.gemini/styleguide.md +0 -35
  49. package/.github/workflows/README.md +0 -5
  50. package/.github/workflows/release.yml +0 -52
  51. package/.github/workflows/validate.yml +0 -27
  52. package/.prettierignore +0 -4
  53. package/.prettierrc +0 -1
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Instructions (lgtm-specs)
2
2
 
3
- This repository (`lgtm-specs`) is a versioned **Knowledge Graph** of specs (rules + agent prompts). Treat changes as spec
4
- edits, not application code.
3
+ This repository (`lgtm-specs`) is a versioned **Knowledge Graph** of specs (rules + agent prompts).
4
+ Treat changes as spec edits, not application code.
5
5
 
6
6
  Repo-local assistant instructions:
7
7
 
@@ -25,6 +25,9 @@ bun run validate
25
25
  # or:
26
26
  python3 scripts/validate_specs.py
27
27
 
28
+ # Unit tests (validator self-tests)
29
+ bun run test
30
+
28
31
  # Formatting (Prettier)
29
32
  bun run format
30
33
  bun run format:check
@@ -97,7 +100,8 @@ Atomic rule requirements (see `rules/RULE-00000-EXAMPLE.md`):
97
100
  Citations and links:
98
101
 
99
102
  - Source-of-truth material lives in `docs/meta/**`; do not invent citations.
100
- - Use repo-root-relative links (`/rules/...`, `/docs/...`) and ensure targets exist.
103
+ - Links: prefer repo-root-relative links (`/rules/...`, `/docs/...`) for stability.
104
+ Relative links are acceptable; follow the local directory convention.
101
105
  - `**Source**` links into `docs/meta/**` should include an anchor (`#...`).
102
106
 
103
107
  Tags and writing:
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -33,8 +33,11 @@ Team:
33
33
  ## Phase 1: Clarify & Design (The Blueprint)
34
34
  1. **Orchestrate**: `@Lead` assesses the request and engages `@Explorer` to map the codebase.
35
35
  2. **Compliance**: `@Lead` consults `@Counsel` for Rules and Policies.
36
- * **Inject**: `@Lead` instructs the Runtime to load/hydrate rule content and inject `{{injected_rules}}` into
37
- `@Planner` and all reviewers used in this mode (`@Plan-Reviewer`, `@Reviewer-Lite`, Panel).
36
+ * **Inject (Dynamic)**: `@Lead` instructs the Runtime to load/hydrate rule content and inject
37
+ `{{injected_rules}}`.
38
+ - `@Planner`: plan-level rules/policies.
39
+ - `@Builder`: step-scoped rules per Task (always include the active Policy rules).
40
+ - Reviewers: review-scope rules/policies for `@Plan-Reviewer`, `@Reviewer-Lite`, and the specialist panel.
38
41
  3. **Draft**: `@Planner` creates the **Execution Plan**.
39
42
  * *Input*: User Request + Map + Rules.
40
43
  4. **Plan Review**: Call **two** independent `@Plan-Reviewer` instances.
@@ -52,11 +55,18 @@ Team:
52
55
 
53
56
  For each Task in the Plan:
54
57
 
55
- 1. **Build**: Call `@Builder` with `(Task, Rules, Verification)`.
58
+ 1. **Build**: Call `@Builder` with `(Task, Files, Requirements, Verification)`.
59
+ - _Constraint_: `Files` MUST come from the Plan step. If missing, `@Lead` routes back to `@Planner` to repair the
60
+ plan.
56
61
  - _Constraint_: Verification is mandatory. The proof level is defined per step (tests and/or other evidence).
62
+ - _Timeout_: 20 minutes per attempt (default; runtime may override).
63
+ - _On Timeout_: Re-assign once; if it times out again, treat as a reject and re-plan or abort.
57
64
  2. **Micro-Audit**: Call `@Reviewer-Lite` on the diff.
58
- - _Scope_: Fast sanity gate (obvious correctness breakage + basic style/tooling + commit message); deep specialist review happens in Phase 3.
59
- - _Input_: Include the PR merge target as `Base Ref` and the atomic `Commit Message` when available.
65
+ - _Scope_: Fast sanity gate (obvious correctness breakage + basic style/tooling + commit message). Deep specialist
66
+ review happens in Phase 3.
67
+ - _Input_: Provide `User Request` + (`Diff` or `Diff Command`).
68
+ Include `Base Ref` whenever the runtime has git metadata (e.g., PR merge target).
69
+ Include the atomic `Commit Message` when available.
60
70
  - _Retry_: Max 3 attempts.
61
71
  - _Timeout_: 5 minutes per attempt.
62
72
  - _On Timeout_: Treat as a reject and retry.
@@ -67,22 +77,43 @@ For each Task in the Plan:
67
77
 
68
78
  1. **Verify**: Ensure required verification passes (including integration tests when required).
69
79
  2. **Audit**: Call the **Full Review Panel**.
70
- - Mandatory: `Logic`, `Quality`, `Test`.
71
- - Conditional: `Security` (if tagged), `Performance` (if tagged).
80
+ - Mandatory: [Logic](../roles/reviewer/logic.md), [Quality](../roles/reviewer/quality.md),
81
+ [Test](../roles/reviewer/test.md).
82
+ - Conditional: [Security](../roles/reviewer/security.md) when `@Lead` marks the work security-sensitive (or
83
+ `@Counsel` selected `#security` rules).
84
+ - Conditional: [Performance](../roles/reviewer/performance.md) when `@Lead` marks the work perf-sensitive (or
85
+ `@Counsel` selected `#efficiency` rules).
86
+ - _Input (each)_: Provide `User Request` + (`Diff` or `Diff Command`).
87
+ Include `Base Ref` whenever the runtime has git metadata (e.g., PR merge target).
88
+ Include `Head Ref` when available.
72
89
  3. **Gate**: Unanimous Approval Required.
73
90
  - _Loop_: Max 10 review->fix cycles.
74
91
  - _Timeout_: 10 minutes per reviewer per cycle.
75
92
  - _On Timeout_: Re-assign each timed-out reviewer once. If it still times out, treat as a reject for that cycle.
76
- - _Clarify_: If a finding is contested or unclear, `@Lead` asks the specific reviewer to justify or withdraw it (one round-trip max) before planning fixes.
77
- - _Cycle_: On each rejection, `@Lead` digests the panel feedback and calls `@Planner` to produce a remediation todo list. `@Builder` executes tasks one at a time, then the panel re-reviews.
78
- - _Compress_: After each cycle, keep a compact "Resolved / Remaining" summary; do not carry full prior transcripts into later cycles.
79
- - _Arbitration (Conditional)_: If reviewers deadlock/contradict, runtime injects the minimum Tier 2 contested diff and
93
+ - _Clarify_: If a finding is contested or unclear, `@Lead` asks the specific reviewer to justify or withdraw it (one
94
+ round-trip max) before planning fixes.
95
+ - _Deadlock Escape_: If the panel stalls for 2 consecutive cycles, `@Lead` must either trigger arbitration or abort;
96
+ do not spin indefinitely.
97
+ - _Cycle_: On each rejection, `@Lead` digests the panel feedback and calls `@Planner` to produce a remediation todo
98
+ list.
99
+ `@Builder` executes tasks one at a time, each passing Phase 2 Micro-Audit before re-entering the panel.
100
+ - _Compress_: After each cycle, keep a compact "Resolved / Remaining" summary; do not carry full prior transcripts
101
+ into later cycles.
102
+ - _Arbitration (Conditional)_: If reviewers deadlock/contradict, runtime injects the minimum Tier 2 contested diff
103
+ and
80
104
  full contested rules into `@Lead`; `@Lead` judges citing rule IDs and diff evidence.
81
105
  - _Override_: If needed, `@Lead` may override with an explicit risk rationale.
82
- - _After Max_: If still not unanimous after 10 cycles, `@Lead` must either abort (recommended) or override with an explicit risk rationale.
106
+ - _Guardrail_: If overriding a security- or test-related rejection, `@Lead` must surface the residual risk and get
107
+ explicit user acknowledgement.
108
+ - _After Max_: If still not unanimous after 10 cycles, `@Lead` must either abort (recommended) or override with an
109
+ explicit risk rationale.
83
110
 
84
111
  ## Phase 4: Delivery
85
112
 
86
113
  - **Finalize**: Produce the Production-Ready PR.
114
+ - **History Hygiene**: Ensure commit messages follow Git laws; squash fixups/WIP; keep atomic story.
115
+ - **PR Hygiene**: Title/body explain intent, risks, and verification evidence; mark Draft vs Ready explicitly.
116
+ - **Merge Plan**: State merge strategy expectations (squash vs merge-commit vs rebase) per repo policy.
117
+ - **Last Check**: Re-run required verification before marking ready.
87
118
 
88
119
  </Workflow>
@@ -50,19 +50,27 @@ Deliver the User Request by coordinating the Engineering Team.
50
50
 
51
51
  <Workflow>
52
52
  1. **Clarify**: If ambiguous, ask targeted questions.
53
- * **Research Trigger**: If the request depends on external truth (official docs/specs/API details), invoke `@Librarian`.
54
- 2. **Assemble Team**: If `<InjectedSubAgents>` contains entries (non-empty), treat it as the allowed subagent set for this run.
53
+ * **Research Trigger**: If the request depends on external truth (official docs/specs/API details),
54
+ invoke `@Librarian`.
55
+ 2. **Assemble Team**: If `<InjectedSubAgents>` contains entries (non-empty), treat it as the allowed subagent set for
56
+ this run.
55
57
  3. **Execute Mode**: Follow the selected mode workflow contract (provided by the Runtime) as the canonical workflow:
56
58
  * `@Build`
57
59
  * `@Hack`
58
60
  * `@Review`
59
- * **Rule Pipeline**: When `@Counsel` returns rule paths, instruct the Runtime to load/hydrate rule content and inject `{{injected_rules}}` into `@Planner` and any reviewers used.
60
- - Inject a **role-appropriate subset** of rules per reviewer (Logic vs Test vs Security vs Performance vs Quality); do not inject all rules into every reviewer.
61
+ * **Rule Pipeline**: When `@Counsel` returns rule paths, instruct the Runtime to load/hydrate rule content and
62
+ inject `{{injected_rules}}` into `@Planner`, `@Builder` (step-scoped per plan step; always include active Policy
63
+ rules), and any reviewers used.
64
+ - Inject a **role-appropriate subset** of rules per reviewer (Logic vs Test vs Security vs Performance vs
65
+ Quality); do not inject all rules into every reviewer.
61
66
  4. **Track Provenance**: Track which reviewer produced which finding so follow-up questions can be routed correctly.
62
- 5. **Clarify Findings (Optional)**: For contested/unclear findings, request one-round clarification from the original reviewer (justify or withdraw).
63
- 6. **Arbitrate (Conditional)**: If reviewers deadlock, contradict each other, or repeatedly reject, request the Runtime to inject full contested rules into `<InjectedRules>` and provide minimal Tier 2 diff context for tie-breaking.
67
+ 5. **Clarify Findings (Optional)**: For contested/unclear findings, request one-round clarification from the original
68
+ reviewer (justify or withdraw).
69
+ 6. **Arbitrate (Conditional)**: If reviewers deadlock, contradict each other, or repeatedly reject, request the Runtime
70
+ to inject full contested rules into `<InjectedRules>` and provide minimal Tier 2 diff context for tie-breaking.
64
71
  * *Precedence*: The selected mode spec defines which gates are overridable.
65
- 7. **Compress Loops**: In multi-cycle review loops, keep a compact "Resolved / Remaining" summary; do not carry full prior transcripts.
72
+ 7. **Compress Loops**: In multi-cycle review loops, keep a compact "Resolved / Remaining" summary; do not carry full
73
+ prior transcripts.
66
74
  </Workflow>
67
75
 
68
76
  <Constraints>
@@ -15,6 +15,7 @@ This directory contains the Standard Operating Procedures (SOPs) for expanding t
15
15
 
16
16
  ## Procedures
17
17
 
18
+ - **[Verification](verification.md)**: Formal integrity checks for the Knowledge Graph.
18
19
  - **[Update Models](update-models.md)**: Update `models/registry.yaml` recommendations.
19
20
  - **[Add a Constitution Article](add-constitution.md)**: For universal principles.
20
21
  - **[Add a Domain Law](add-law.md)**: For language-specific rules.
@@ -32,11 +32,15 @@
32
32
  - [ ] **Domain Index**: Added to `rules/laws/[domain]/README.md` (if Law).
33
33
  - [ ] **Master Index**: Added to `rules/constitution/README.md` (if Constitution).
34
34
  - [ ] **Agent Spec**: If adding an Agent, it is listed in `agents/README.md`.
35
- - [ ] **Capability**: If adding a role agent, `<Meta>` includes `Capability: ...` and it exists in `models/registry.yaml`.
36
- - [ ] **Rule Injection Placeholder**: If an agent requires rules, it includes a literal `{{injected_rules}}` placeholder.
37
- - [ ] **Mode Teams**: If the agent is used by a Mode, it is listed in that Mode's `<Team>` section (`agents/modes/build.md`, `agents/modes/hack.md`, `agents/modes/review.md`).
35
+ - [ ] **Capability**: If adding a role agent, `<Meta>` includes `Capability: ...` and it exists in
36
+ `models/registry.yaml`.
37
+ - [ ] **Rule Injection Placeholder**: If an agent requires rules, it includes a literal `{{injected_rules}}`
38
+ placeholder.
39
+ - [ ] **Mode Teams**: If the agent is used by a Mode, it is listed in that Mode's `Team:` block inside `<Meta>`
40
+ (`agents/modes/build.md`, `agents/modes/hack.md`, `agents/modes/review.md`).
38
41
 
39
42
  ## Phase 5: CI (If applicable)
40
43
 
41
- - [ ] **Validation**: `python3 scripts/validate_specs.py` passes locally.
44
+ - [ ] **CI Parity**: `bun run check` passes locally (validator + Prettier check).
45
+ - [ ] **Validation (Optional)**: `python3 scripts/validate_specs.py` passes locally.
42
46
  - [ ] **Workflow Index**: New workflows are listed in `.github/workflows/README.md`.
@@ -0,0 +1,122 @@
1
+ # Verification & Integrity Checks
2
+
3
+ This repo is a specification Knowledge Graph (Zettelkasten). "Verification" means proving the graph is:
4
+
5
+ - structurally valid (atomic nodes, required metadata/sections),
6
+ - correctly indexed (discoverable from directory READMEs),
7
+ - correctly linked (no broken internal links; meta anchors exist),
8
+ - consistent with integration contracts (capabilities + spec version).
9
+
10
+ ## Quick Start (CI Parity)
11
+
12
+ Run exactly what CI runs:
13
+
14
+ ```bash
15
+ bun run check
16
+ ```
17
+
18
+ This executes:
19
+
20
+ ```bash
21
+ bun run validate
22
+ bun run test
23
+ bun run format:check
24
+ ```
25
+
26
+ ## Validator: What It Enforces
27
+
28
+ `python3 scripts/validate_specs.py` fails the build on any WARN/ERROR (unless baselined).
29
+
30
+ ### Spec Versioning
31
+
32
+ - `VERSION` must match `integrate/README.md` `**Spec Version**:`.
33
+
34
+ ### Rules (`rules/**`)
35
+
36
+ Validated files:
37
+
38
+ - Atomic rules: `rules/constitution/**`, `rules/laws/**` (excluding directory `README.md`)
39
+ - Rule-like scaffolding: `rules/policies/**`, `rules/laws/default.md`, `rules/RULE-00000-EXAMPLE.md`
40
+
41
+ Checks:
42
+
43
+ - Required shape: H1 title + `**Source**`, `**Tags**`, `**Related**`
44
+ - Required sections: `## Definition`, `## Requirements`, `## Anti-Patterns`, `## Examples`
45
+ - Examples must include both `**Bad:**` and `**Good:**`
46
+ - Dimension tagging: `**Tags**` must include at least one of `#structural #behavioral #runtime #operational`
47
+ - Indexing: every validated file must be listed in its parent directory `README.md`
48
+ - Metadata links: internal `**Source**` and `**Related**` links must resolve to real files
49
+ - Meta anchors: `**Source**` links into `docs/meta/**` must include a `#anchor`, and that anchor must exist as a heading
50
+ - Law derivation: every `rules/laws/**` file must include at least one Constitution link in `**Related**`
51
+
52
+ ### Agents (`agents/**`)
53
+
54
+ - Every role agent `<Meta>` must declare `Capability: <id>`
55
+ - Capabilities must exist in `models/registry.yaml`
56
+
57
+ ## Fast Single-File Checks
58
+
59
+ Useful when authoring a new/edited rule node:
60
+
61
+ ```bash
62
+ FILE="rules/constitution/CONS-00027-transparency.md"
63
+
64
+ bunx prettier --check "$FILE"
65
+ python3 scripts/validate_specs.py
66
+ ```
67
+
68
+ For ultra-fast local sanity (shape + indexing only):
69
+
70
+ ```bash
71
+ test -f "$FILE" && echo "OK: exists"
72
+ grep -q "$(basename "$FILE")" "$(dirname "$FILE")/README.md" && echo "OK: indexed"
73
+ ```
74
+
75
+ ## Optional: External URL Checks
76
+
77
+ External link validation is network-dependent and opt-in:
78
+
79
+ ```bash
80
+ python3 scripts/validate_specs.py --check-urls
81
+ python3 scripts/validate_specs.py --check-urls --url-timeout 12
82
+ python3 scripts/validate_specs.py --check-urls --url-ignore "https://example.com/badge.svg"
83
+ ```
84
+
85
+ ## Optional: Temporary Baseline (Migrations Only)
86
+
87
+ If the repo is mid-migration and you need to land incremental fixes:
88
+
89
+ ```bash
90
+ python3 scripts/validate_specs.py --write-baseline scripts/validate_baseline.txt
91
+ python3 scripts/validate_specs.py --baseline scripts/validate_baseline.txt
92
+ ```
93
+
94
+ Baseline rules:
95
+
96
+ - Use baselines only temporarily.
97
+ - Prefer fixing the underlying issues.
98
+ - Keep the baseline deterministic (no timestamps).
99
+
100
+ ## Common Failure Modes
101
+
102
+ - "File not indexed": add the filename to the parent `README.md` index.
103
+ - "Broken **Source**/**Related** link": fix relative depth or use repo-root-relative links (`/docs/...`, `/rules/...`).
104
+ - "Internal Source link missing #anchor" / "Broken Source anchor": open the target `docs/meta/**` file, find the
105
+ heading, and update the link to match the heading anchor.
106
+ - "Law missing Constitution link": add the most relevant `CONS-xxxxx` article to `**Related**`.
107
+
108
+ ## Optional: Review Artifacts (Runtime)
109
+
110
+ Some runtimes persist review artifacts (reviewer outputs, rule injection logs) to help debug long review loops.
111
+
112
+ - Spec: `integrate/artifacts.md`
113
+ - Recommended location: `.lgtm-local/` (ignored by git; also excluded from Prettier checks)
114
+ - Recommended lifecycle: keep during the active panel loop; auto-delete on completion unless retention/stats mode is
115
+ enabled
116
+
117
+ ## Related
118
+
119
+ - `contribute/checklist.md`
120
+ - `rules/RULE-00000-EXAMPLE.md`
121
+ - `scripts/README.md`
122
+ - `integrate/artifacts.md`
@@ -1,6 +1,7 @@
1
1
  # Engineering Best Practices & Master Rule List
2
2
 
3
- This document is the "Source of Truth" for all engineering standards enforced by LGTM. It groups principles by their intellectual lineage and provides primary source references.
3
+ This document is the "Source of Truth" for all engineering standards enforced by LGTM.
4
+ It groups principles by their intellectual lineage and provides primary source references.
4
5
 
5
6
  **Table of Contents**
6
7
 
@@ -98,7 +99,8 @@ A tactical approach to managing complexity by focusing on module depth and infor
98
99
 
99
100
  ## 2.4 Defining Errors Out of Existence
100
101
 
101
- **Definition**: The best way to handle errors is to design APIs so the error condition is impossible or part of the normal flow.
102
+ **Definition**: The best way to handle errors is to design APIs so the error condition is impossible.
103
+ Alternatively, make the condition a first-class part of the normal flow.
102
104
 
103
105
  - **Requirement**: Use sensible defaults (e.g., empty string instead of error).
104
106
  - **Requirement**: Design interfaces so the "error case" is a valid branch of logic.
@@ -163,11 +165,20 @@ _Source: [Zen of Python](https://peps.python.org/pep-0020/)_
163
165
  - **Requirement**: Explicit is better than implicit. No global state.
164
166
  - **Requirement**: Dependencies and side effects must be visible in signatures.
165
167
 
168
+ ## 3.6 Composition Over Inheritance
169
+
170
+ _Source: [Composition over inheritance](https://en.wikipedia.org/wiki/Composition_over_inheritance)_
171
+ **Definition**: Prefer composition and delegation over deep inheritance trees to reduce coupling.
172
+
173
+ - **Requirement**: Favor small composable components with explicit dependencies.
174
+ - **Requirement**: Use interfaces + composition to vary behavior without fragile base classes.
175
+
166
176
  ---
167
177
 
168
178
  # 4. Pragmatic Programmer & Code Health
169
179
 
170
- _Source: [Hunt & Thomas](https://en.wikipedia.org/wiki/The_Pragmatic_Programmer) / [Atul Gawande](https://en.wikipedia.org/wiki/The_Checklist_Manifesto)_
180
+ _Source: [Hunt & Thomas](https://en.wikipedia.org/wiki/The_Pragmatic_Programmer)_
181
+ _Source: [Atul Gawande](https://en.wikipedia.org/wiki/The_Checklist_Manifesto)_
171
182
  Tactical rules for maintaining code quality over time.
172
183
 
173
184
  ## 4.1 The Boy Scout Rule
@@ -203,7 +214,8 @@ _Source: [The Checklist Manifesto](https://en.wikipedia.org/wiki/The_Checklist_M
203
214
 
204
215
  # 5. Systems Theory & Dynamics
205
216
 
206
- _Source: [Melvin Conway](https://en.wikipedia.org/wiki/Conway%27s_law) / [Jay Forrester](https://en.wikipedia.org/wiki/System_dynamics)_
217
+ _Source: [Melvin Conway](https://en.wikipedia.org/wiki/Conway%27s_law)_
218
+ _Source: [Jay Forrester](https://en.wikipedia.org/wiki/System_dynamics)_
207
219
  Understanding software development as a complex adaptive system.
208
220
 
209
221
  ## 5.1 Shift Left
@@ -231,7 +243,8 @@ _Source: [System Dynamics Modeling](https://en.wikipedia.org/wiki/The_Mythical_M
231
243
 
232
244
  # 6. Formal Methods & Correctness
233
245
 
234
- _Source: [Type Theory](https://en.wikipedia.org/wiki/Type_theory) / [Jon Postel](https://en.wikipedia.org/wiki/Robustness_principle)_
246
+ _Source: [Type Theory](https://en.wikipedia.org/wiki/Type_theory)_
247
+ _Source: [Jon Postel](https://en.wikipedia.org/wiki/Robustness_principle)_
235
248
  Ensuring code behaves correctly by construction.
236
249
 
237
250
  ## 6.1 Safety by Design
@@ -260,12 +273,14 @@ _Source: [Robustness Principle](https://en.wikipedia.org/wiki/Robustness_princip
260
273
 
261
274
  # 7. Distributed Systems
262
275
 
263
- _Source: [Eric Brewer](https://en.wikipedia.org/wiki/CAP_theorem) / [L. Peter Deutsch](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing)_
276
+ _Source: [Eric Brewer](https://en.wikipedia.org/wiki/CAP_theorem)_
277
+ _Source: [L. Peter Deutsch](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing)_
264
278
  Rules for code that crosses network boundaries.
265
279
 
266
280
  ## 7.1 CAP & PACELC
267
281
 
268
- _Source: [CAP Theorem](https://en.wikipedia.org/wiki/CAP_theorem) / [PACELC](https://en.wikipedia.org/wiki/PACELC_theorem)_
282
+ _Source: [CAP Theorem](https://en.wikipedia.org/wiki/CAP_theorem)_
283
+ _Source: [PACELC](https://en.wikipedia.org/wiki/PACELC_theorem)_
269
284
  **Definition**: Distributed systems must explicitly choose between Consistency and Availability.
270
285
 
271
286
  - **Requirement**: Document the consistency model for every distributed component.
@@ -273,7 +288,8 @@ _Source: [CAP Theorem](https://en.wikipedia.org/wiki/CAP_theorem) / [PACELC](htt
273
288
  ## 7.2 Fallacies of Distributed Computing
274
289
 
275
290
  _Source: [The 8 Fallacies](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing)_
276
- **Definition**: False assumptions that L. Peter Deutsch and colleagues identified as the root of most distributed system failures.
291
+ **Definition**: False assumptions identified by L. Peter Deutsch and colleagues.
292
+ They are the root of many distributed system failures.
277
293
 
278
294
  - **Requirement**: You must actively design mitigation for _each_ of these false assumptions:
279
295
  1. **The network is reliable.** (Mitigation: Retries, Acknowledgements)
@@ -289,7 +305,8 @@ _Source: [The 8 Fallacies](https://en.wikipedia.org/wiki/Fallacies_of_distribute
289
305
 
290
306
  # 8. Classic Engineering Wisdom
291
307
 
292
- _Source: [Extreme Programming](https://en.wikipedia.org/wiki/Extreme_programming) / [Lockheed Skunk Works](https://en.wikipedia.org/wiki/KISS_principle)_
308
+ _Source: [Extreme Programming](https://en.wikipedia.org/wiki/Extreme_programming)_
309
+ _Source: [Lockheed Skunk Works](https://en.wikipedia.org/wiki/KISS_principle)_
293
310
 
294
311
  ## 8.1 KISS (Keep It Simple, Stupid)
295
312
 
@@ -325,7 +342,8 @@ _Source: [Law of Demeter](https://en.wikipedia.org/wiki/Law_of_Demeter)_
325
342
 
326
343
  # 9. Security Engineering
327
344
 
328
- _Source: [OWASP](https://owasp.org/www-project-top-ten/) / [Saltzer and Schroeder](https://en.wikipedia.org/wiki/Saltzer_and_Schroeder%27s_design_principles)_
345
+ _Source: [OWASP](https://owasp.org/www-project-top-ten/)_
346
+ _Source: [Saltzer and Schroeder](https://en.wikipedia.org/wiki/Saltzer_and_Schroeder%27s_design_principles)_
329
347
 
330
348
  ## 9.1 Principle of Least Privilege
331
349