lgtm-specs 0.0.4

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 (212) hide show
  1. package/.claude/settings.local.json +14 -0
  2. package/.gemini/README.md +8 -0
  3. package/.gemini/config.yaml +20 -0
  4. package/.gemini/styleguide.md +35 -0
  5. package/.github/workflows/README.md +5 -0
  6. package/.github/workflows/release.yml +52 -0
  7. package/.github/workflows/validate.yml +27 -0
  8. package/.prettierignore +4 -0
  9. package/.prettierrc +1 -0
  10. package/AGENTS.md +151 -0
  11. package/README.md +98 -0
  12. package/VERSION +1 -0
  13. package/agents/README.md +73 -0
  14. package/agents/modes/README.md +9 -0
  15. package/agents/modes/build.md +88 -0
  16. package/agents/modes/hack.md +76 -0
  17. package/agents/modes/review.md +79 -0
  18. package/agents/roles/builder.md +75 -0
  19. package/agents/roles/counsel.md +96 -0
  20. package/agents/roles/explorer.md +77 -0
  21. package/agents/roles/lead.md +76 -0
  22. package/agents/roles/librarian.md +63 -0
  23. package/agents/roles/planner.md +75 -0
  24. package/agents/roles/reviewer/BASE.md +9 -0
  25. package/agents/roles/reviewer/OUTPUT_FORMAT.md +4 -0
  26. package/agents/roles/reviewer/README.md +48 -0
  27. package/agents/roles/reviewer/lite.md +51 -0
  28. package/agents/roles/reviewer/logic.md +48 -0
  29. package/agents/roles/reviewer/performance.md +45 -0
  30. package/agents/roles/reviewer/plan.md +52 -0
  31. package/agents/roles/reviewer/quality.md +49 -0
  32. package/agents/roles/reviewer/security.md +47 -0
  33. package/agents/roles/reviewer/test.md +48 -0
  34. package/agents/templates/README.md +6 -0
  35. package/agents/templates/mode.md +33 -0
  36. package/agents/templates/role.md +73 -0
  37. package/contribute/README.md +24 -0
  38. package/contribute/add-agent.md +29 -0
  39. package/contribute/add-ci.md +31 -0
  40. package/contribute/add-constitution.md +17 -0
  41. package/contribute/add-law.md +20 -0
  42. package/contribute/add-policy.md +27 -0
  43. package/contribute/checklist.md +42 -0
  44. package/contribute/maintenance.md +19 -0
  45. package/contribute/update-models.md +47 -0
  46. package/docs/README.md +13 -0
  47. package/docs/adr/0001-knowledge-engineering-workflow.md +22 -0
  48. package/docs/adr/0002-rule-hierarchy.md +25 -0
  49. package/docs/adr/0003-atomic-knowledge-graph.md +21 -0
  50. package/docs/adr/0004-identification-schema.md +22 -0
  51. package/docs/adr/0005-agent-specialization.md +39 -0
  52. package/docs/adr/0006-git-workflow-integrity.md +34 -0
  53. package/docs/adr/0007-operating-modes-and-gates.md +54 -0
  54. package/docs/adr/0008-rules-vs-workflows-boundary.md +64 -0
  55. package/docs/adr/README.md +14 -0
  56. package/docs/agent_architecture.md +164 -0
  57. package/docs/context_lifecycle.md +228 -0
  58. package/docs/engineering_principles.md +128 -0
  59. package/docs/local_policies.md +59 -0
  60. package/docs/meta/collaborative_dynamics.md +142 -0
  61. package/docs/meta/domains/README.md +8 -0
  62. package/docs/meta/domains/bitcoin/01-units.md +21 -0
  63. package/docs/meta/domains/bitcoin/02-broadcast-cancellation.md +20 -0
  64. package/docs/meta/domains/bitcoin/03-fee-rates-rounding.md +21 -0
  65. package/docs/meta/domains/bitcoin/04-confirmations-reorgs.md +20 -0
  66. package/docs/meta/domains/bitcoin/05-address-gap-limit.md +16 -0
  67. package/docs/meta/domains/bitcoin/06-relay-policy.md +27 -0
  68. package/docs/meta/domains/bitcoin/README.md +12 -0
  69. package/docs/meta/domains/git/01-workflow.md +89 -0
  70. package/docs/meta/domains/git/02-commits.md +57 -0
  71. package/docs/meta/domains/git/03-collaboration.md +40 -0
  72. package/docs/meta/domains/git/04-integrity.md +26 -0
  73. package/docs/meta/domains/git/05-configuration.md +209 -0
  74. package/docs/meta/domains/git/06-advanced.md +130 -0
  75. package/docs/meta/domains/git/README.md +29 -0
  76. package/docs/meta/industry_best_practices.md +555 -0
  77. package/docs/meta/languages/README.md +8 -0
  78. package/docs/meta/languages/go/01-concurrency.md +37 -0
  79. package/docs/meta/languages/go/02-api-design.md +30 -0
  80. package/docs/meta/languages/go/03-resilience.md +27 -0
  81. package/docs/meta/languages/go/04-errors.md +27 -0
  82. package/docs/meta/languages/go/05-performance.md +18 -0
  83. package/docs/meta/languages/go/06-safety.md +18 -0
  84. package/docs/meta/languages/go/07-testing.md +44 -0
  85. package/docs/meta/languages/go/08-config-layout.md +23 -0
  86. package/docs/meta/languages/go/README.md +14 -0
  87. package/docs/meta/languages/typescript/01-strictness.md +19 -0
  88. package/docs/meta/languages/typescript/02-immutability.md +15 -0
  89. package/docs/meta/languages/typescript/03-async.md +18 -0
  90. package/docs/meta/languages/typescript/04-design.md +19 -0
  91. package/docs/meta/languages/typescript/05-control-flow.md +11 -0
  92. package/docs/meta/languages/typescript/README.md +11 -0
  93. package/docs/meta/workflow.md +68 -0
  94. package/docs/philosophy.md +36 -0
  95. package/integrate/README.md +459 -0
  96. package/integrate/versioning.md +41 -0
  97. package/models/README.md +68 -0
  98. package/models/registry.yaml +55 -0
  99. package/package.json +11 -0
  100. package/rules/README.md +57 -0
  101. package/rules/RULE-00000-EXAMPLE.md +29 -0
  102. package/rules/constitution/CONS-00001-srp.md +40 -0
  103. package/rules/constitution/CONS-00002-ocp.md +43 -0
  104. package/rules/constitution/CONS-00003-lsp.md +44 -0
  105. package/rules/constitution/CONS-00004-isp.md +46 -0
  106. package/rules/constitution/CONS-00005-dip.md +37 -0
  107. package/rules/constitution/CONS-00006-dry.md +45 -0
  108. package/rules/constitution/CONS-00007-demeter.md +35 -0
  109. package/rules/constitution/CONS-00008-composition.md +44 -0
  110. package/rules/constitution/CONS-00009-deep-modules.md +39 -0
  111. package/rules/constitution/CONS-00010-kiss.md +47 -0
  112. package/rules/constitution/CONS-00011-yagni.md +49 -0
  113. package/rules/constitution/CONS-00012-cognitive-limits.md +28 -0
  114. package/rules/constitution/CONS-00013-boy-scout.md +27 -0
  115. package/rules/constitution/CONS-00014-broken-windows.md +35 -0
  116. package/rules/constitution/CONS-00015-safety.md +46 -0
  117. package/rules/constitution/CONS-00016-cqs.md +39 -0
  118. package/rules/constitution/CONS-00017-postel.md +35 -0
  119. package/rules/constitution/CONS-00018-cap.md +35 -0
  120. package/rules/constitution/CONS-00019-fallacies.md +37 -0
  121. package/rules/constitution/CONS-00020-shift-left.md +28 -0
  122. package/rules/constitution/CONS-00021-congruence.md +28 -0
  123. package/rules/constitution/CONS-00022-orthogonality.md +40 -0
  124. package/rules/constitution/CONS-00023-determinism.md +38 -0
  125. package/rules/constitution/CONS-00024-security.md +42 -0
  126. package/rules/constitution/CONS-00025-efficiency.md +38 -0
  127. package/rules/constitution/CONS-00026-resilience.md +41 -0
  128. package/rules/constitution/CONS-00027-transparency.md +40 -0
  129. package/rules/constitution/CONS-00028-evolvability.md +36 -0
  130. package/rules/constitution/CONS-00029-operability.md +36 -0
  131. package/rules/constitution/CONS-00030-rework-cycle.md +27 -0
  132. package/rules/constitution/CONS-00031-checklist.md +28 -0
  133. package/rules/constitution/CONS-00032-documentation.md +39 -0
  134. package/rules/constitution/README.md +52 -0
  135. package/rules/laws/README.md +15 -0
  136. package/rules/laws/bitcoin/BTC-00001-amounts-as-satoshis.md +39 -0
  137. package/rules/laws/bitcoin/BTC-00002-broadcast-not-cancelable.md +36 -0
  138. package/rules/laws/bitcoin/BTC-00003-fee-rate-math-rounding.md +37 -0
  139. package/rules/laws/bitcoin/BTC-00004-confirmations-and-reorgs.md +40 -0
  140. package/rules/laws/bitcoin/BTC-00005-address-gap-limit.md +37 -0
  141. package/rules/laws/bitcoin/BTC-00006-relay-is-policy-dependent.md +36 -0
  142. package/rules/laws/bitcoin/BTC-00007-dust-policy.md +36 -0
  143. package/rules/laws/bitcoin/BTC-00008-min-relay-fee.md +36 -0
  144. package/rules/laws/bitcoin/BTC-00009-feefilter.md +36 -0
  145. package/rules/laws/bitcoin/README.md +29 -0
  146. package/rules/laws/default.md +30 -0
  147. package/rules/laws/git/GIT-00001-atomic-commit.md +29 -0
  148. package/rules/laws/git/GIT-00002-imperative-subject.md +27 -0
  149. package/rules/laws/git/GIT-00003-formatting-50-72.md +28 -0
  150. package/rules/laws/git/GIT-00004-trunk-based.md +28 -0
  151. package/rules/laws/git/GIT-00005-public-immutability.md +26 -0
  152. package/rules/laws/git/GIT-00006-signing.md +27 -0
  153. package/rules/laws/git/GIT-00007-reviewer-capital.md +26 -0
  154. package/rules/laws/git/GIT-00008-patch-series.md +28 -0
  155. package/rules/laws/git/GIT-00009-branch-naming.md +28 -0
  156. package/rules/laws/git/GIT-00010-pr-hygiene.md +51 -0
  157. package/rules/laws/git/GIT-00011-merge-method.md +35 -0
  158. package/rules/laws/git/GIT-00012-conflict-resolution.md +35 -0
  159. package/rules/laws/git/GIT-00013-ignore-standards.md +38 -0
  160. package/rules/laws/git/GIT-00014-lfs-large-binaries.md +37 -0
  161. package/rules/laws/git/GIT-00015-git-hooks.md +35 -0
  162. package/rules/laws/git/GIT-00016-branch-protection.md +34 -0
  163. package/rules/laws/git/GIT-00017-secrets-management.md +34 -0
  164. package/rules/laws/git/GIT-00018-ci-enforcement.md +33 -0
  165. package/rules/laws/git/GIT-00019-review-checklist.md +39 -0
  166. package/rules/laws/git/GIT-00020-issue-references.md +34 -0
  167. package/rules/laws/git/GIT-00021-partial-staging.md +38 -0
  168. package/rules/laws/git/GIT-00022-feature-flags.md +33 -0
  169. package/rules/laws/git/GIT-00023-breaking-changes.md +41 -0
  170. package/rules/laws/git/GIT-00024-dependency-management.md +44 -0
  171. package/rules/laws/git/GIT-00025-large-repository-optimization.md +54 -0
  172. package/rules/laws/git/README.md +31 -0
  173. package/rules/laws/go/GO-00001-actor-model.md +51 -0
  174. package/rules/laws/go/GO-00002-api-design.md +37 -0
  175. package/rules/laws/go/GO-00003-error-handling.md +43 -0
  176. package/rules/laws/go/GO-00004-context.md +45 -0
  177. package/rules/laws/go/GO-00005-performance.md +40 -0
  178. package/rules/laws/go/GO-00006-packages.md +29 -0
  179. package/rules/laws/go/GO-00007-circuit-breakers.md +43 -0
  180. package/rules/laws/go/GO-00008-safety.md +39 -0
  181. package/rules/laws/go/GO-00009-table-driven-test.md +48 -0
  182. package/rules/laws/go/GO-00010-escape-analysis.md +37 -0
  183. package/rules/laws/go/GO-00011-retry.md +45 -0
  184. package/rules/laws/go/GO-00012-rate-limiting.md +42 -0
  185. package/rules/laws/go/GO-00013-io-buffering.md +43 -0
  186. package/rules/laws/go/GO-00014-memory-layout.md +41 -0
  187. package/rules/laws/go/GO-00015-aaa-pattern.md +49 -0
  188. package/rules/laws/go/GO-00016-test-libraries.md +35 -0
  189. package/rules/laws/go/GO-00017-comments.md +37 -0
  190. package/rules/laws/go/GO-00018-test-isolation.md +38 -0
  191. package/rules/laws/go/GO-00019-test-comments.md +36 -0
  192. package/rules/laws/go/GO-00020-mocking.md +36 -0
  193. package/rules/laws/go/GO-00021-configuration.md +36 -0
  194. package/rules/laws/go/GO-00022-observability.md +34 -0
  195. package/rules/laws/go/GO-00023-dependency-management.md +28 -0
  196. package/rules/laws/go/GO-00024-project-layout.md +30 -0
  197. package/rules/laws/go/GO-00025-concurrency-patterns.md +39 -0
  198. package/rules/laws/go/README.md +45 -0
  199. package/rules/laws/typescript/README.md +14 -0
  200. package/rules/laws/typescript/TS-00001-no-any.md +39 -0
  201. package/rules/laws/typescript/TS-00002-immutability.md +36 -0
  202. package/rules/laws/typescript/TS-00003-async.md +35 -0
  203. package/rules/laws/typescript/TS-00004-strict-null.md +38 -0
  204. package/rules/laws/typescript/TS-00005-unions.md +35 -0
  205. package/rules/laws/typescript/TS-00006-interface.md +38 -0
  206. package/rules/laws/typescript/TS-00007-generics.md +38 -0
  207. package/rules/laws/typescript/TS-00008-modules.md +28 -0
  208. package/rules/policies/README.md +12 -0
  209. package/rules/policies/default.md +28 -0
  210. package/scripts/README.md +45 -0
  211. package/scripts/generate_release_notes.py +376 -0
  212. package/scripts/validate_specs.py +730 -0
@@ -0,0 +1,18 @@
1
+ # Performance & Efficiency
2
+
3
+ **Source**: [btcwallet Engineering Guide](https://github.com/btcsuite/btcwallet/blob/master/docs/developer/ENGINEERING_GUIDE.md)
4
+
5
+ ## 1. Reduce Allocations
6
+
7
+ - **Pre-allocation**: If you know the size of a slice/map, allocate it upfront.
8
+ - `make([]int, 0, 1000)` prevents ~10 re-allocations and copies during append.
9
+ - **Sync.Pool**: For hot paths (e.g., HTTP handlers), reuse complex objects (buffers, encoders) to reduce GC pressure.
10
+
11
+ ## 2. Compiler optimizations
12
+
13
+ - **Field Alignment**: Order struct fields from largest (int64/ptr) to smallest (bool) to minimize memory padding.
14
+ - **Escape Analysis**: Use `go build -gcflags="-m"` to see if variables escape to the heap unnecessarily.
15
+
16
+ ## 3. I/O Optimization
17
+
18
+ - **Buffering**: Use `bufio.Reader/Writer` to reduce system calls for network/disk I/O.
@@ -0,0 +1,18 @@
1
+ # Implementation Safety
2
+
3
+ **Source**: [btcwallet Engineering Guide](https://github.com/btcsuite/btcwallet/blob/master/docs/developer/ENGINEERING_GUIDE.md)
4
+
5
+ ## 1. Concurrency Safety
6
+
7
+ Go's built-in maps and slices are **NOT** thread-safe.
8
+
9
+ - **Maps/Slices**: If accessed by >1 goroutine, you MUST use a `sync.Mutex` or `sync.RWMutex`.
10
+ - **Copying Locks**: Never copy a struct that contains a Mutex. Pass by pointer (`*MyStruct`).
11
+
12
+ ## 2. Atomic Operations
13
+
14
+ For simple counters or boolean flags, use `sync/atomic` instead of a Mutex. It is significantly faster and prevents deadlock risks.
15
+
16
+ ## 3. Lazy Initialization
17
+
18
+ Use `sync.Once` for expensive resources that should only be initialized on first use.
@@ -0,0 +1,44 @@
1
+ # Testing Strategy
2
+
3
+ **Source**: [Unit Testing Guidelines](https://github.com/btcsuite/btcwallet/blob/master/docs/developer/unit_testing_guidelines.md)
4
+
5
+ ## 1. AAA (Arrange, Act, Assert)
6
+
7
+ Every test body must follow this structure, separated by blank lines.
8
+
9
+ 1. **Arrange**: Set up inputs and mocks.
10
+ 2. **Act**: Execute the function under test.
11
+ 3. **Assert**: Check results.
12
+
13
+ ## 2. Table-Driven Tests
14
+
15
+ Best for testing data variance on pure functions.
16
+
17
+ - **Data Only**: Test case structs must contain _Data Only_ (inputs/outputs). No functions or setup logic allowed in the struct.
18
+ - **Identical Setup**: The `Arrange` block must be identical for all cases. If you need `if tc.flag { mock... }`, do not use a table.
19
+
20
+ ## 3. Standalone Tests
21
+
22
+ Best for complex orchestration or unique setups.
23
+
24
+ - **Rule**: When setups differ, use separate, standalone functions. Clarity > DRY in tests.
25
+ - **Scope**: Use for verifying a sequence of side effects (Mock A -> Mock B).
26
+
27
+ ## 4. Libraries
28
+
29
+ - **Assertions**: Use `testify/require` (Fail Fast) for everything. Only use `assert` if you explicitly want to see multiple failures (rare).
30
+ - **Clarity**: "One test, one concept."
31
+
32
+ ## 5. Documentation
33
+
34
+ Tests explain _how_ the system is verified.
35
+
36
+ - **Phase Comments**: Use `// Arrange` (or descriptive equivalents) to label sections.
37
+ - **Descriptive**: `// Setup service with valid config` is better than just `// Arrange`.
38
+
39
+ ## 6. Mocking
40
+
41
+ Use mocks to isolate the unit under test.
42
+
43
+ - **Interfaces**: Mock at the interface level using tools like `mockery` or `gomock`.
44
+ - **Expectations**: Define expected calls explicitly in the Arrange phase.
@@ -0,0 +1,23 @@
1
+ # Project Layout & Configuration
2
+
3
+ **Source**: [Standard Go Project Layout](https://github.com/golang-standards/project-layout)
4
+
5
+ ## 1. The Standard Layout
6
+
7
+ - `/cmd`: Main applications (entry points). No business logic.
8
+ - `/internal`: Private application and library code. Enforced by compiler.
9
+ - `/pkg`: Library code that is safe for _external_ consumption. (Commitment to stability).
10
+ - `/api`: IDL definitions (Proto, OpenAPI).
11
+ - `/configs`: Configuration files (templates).
12
+
13
+ ## 2. Dependency Management
14
+
15
+ - **Modules**: Use `go.mod`.
16
+ - **Minimal Version Selection (MVS)**: Go selects the _oldest_ allowed version. Explicit upgrades (`go get -u`) are required.
17
+ - **Vendoring**: Use `go mod vendor` for hermetic builds in critical environments.
18
+
19
+ ## 3. Configuration (12-Factor)
20
+
21
+ - **Source**: Config comes from the Environment (Env Vars), not hardcoded constants.
22
+ - **Tools**: Use `viper` (complex) or `env` (simple).
23
+ - **Defaults**: Define sensible defaults in code.
@@ -0,0 +1,14 @@
1
+ # The Law of Go (Meta)
2
+
3
+ This directory contains the detailed engineering patterns for Go.
4
+
5
+ ## Index
6
+
7
+ - [01-concurrency.md](01-concurrency.md)
8
+ - [02-api-design.md](02-api-design.md)
9
+ - [03-resilience.md](03-resilience.md)
10
+ - [04-errors.md](04-errors.md)
11
+ - [05-performance.md](05-performance.md)
12
+ - [06-safety.md](06-safety.md)
13
+ - [07-testing.md](07-testing.md)
14
+ - [08-config-layout.md](08-config-layout.md)
@@ -0,0 +1,19 @@
1
+ # Type System Strictness
2
+
3
+ **Source**: [Total TypeScript](https://www.totaltypescript.com)
4
+
5
+ ## 1. No Any
6
+
7
+ The usage of `any` is strictly forbidden. It defeats the purpose of the type system.
8
+
9
+ - **Alternative**: Use `unknown` and narrow it with Type Guards (Zod).
10
+
11
+ ## 2. Strict Null Checks
12
+
13
+ `null` and `undefined` must be handled explicitly.
14
+
15
+ - **Config**: Ensure `strictNullChecks: true` in `tsconfig.json`.
16
+
17
+ ## 3. No Implicit Any
18
+
19
+ All variables and return types must be explicitly typed if inference is ambiguous.
@@ -0,0 +1,15 @@
1
+ # Immutability & State
2
+
3
+ **Source**: [Functional Core, Imperative Shell](https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell)
4
+
5
+ ## 1. Const by Default
6
+
7
+ Use `let` only when re-assignment is logically necessary (e.g., accumulators). Never use `var`.
8
+
9
+ ## 2. Readonly
10
+
11
+ Prefer `readonly` arrays (`readonly T[]`) and `readonly` interface properties to prevent accidental mutation passed by reference.
12
+
13
+ ## 3. Functional Core
14
+
15
+ Prefer pure functions that return new state over classes that mutate internal state.
@@ -0,0 +1,18 @@
1
+ # Asynchronous Patterns
2
+
3
+ **Source**: [Modern TypeScript](https://google.github.io/styleguide/tsguide.html)
4
+
5
+ ## 1. Async/Await
6
+
7
+ Use `async/await` exclusively. Avoid `.then()` and `.catch()` chains unless interfacing with legacy APIs.
8
+
9
+ ## 2. Floating Promises
10
+
11
+ Every Promise must be awaited or explicitly voided.
12
+
13
+ - **Bad**: `doAsyncWork();`
14
+ - **Good**: `await doAsyncWork();` or `void doAsyncWork();`
15
+
16
+ ## 3. Error Handling
17
+
18
+ Use `try/catch` blocks for async errors. For expected failures, consider returning a Result type (`{ success: boolean, error?: Error }`).
@@ -0,0 +1,19 @@
1
+ # Component & API Design
2
+
3
+ **Source**: [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html)
4
+
5
+ ## 1. Interface vs Type
6
+
7
+ - **Interface**: Use for public APIs, object shapes, and class contracts. They support merging and better error messages.
8
+ - **Type**: Use for Unions, Intersections, and Primitives.
9
+
10
+ ## 2. Generics
11
+
12
+ Use generics to create reusable logic, but always constrain them (`T extends User`). Unconstrained generics (`T`) are often a code smell for `any`.
13
+
14
+ ## 3. Module Organization
15
+
16
+ Organize code by Feature/Domain, not by technical type.
17
+
18
+ - **Bad**: `src/types`, `src/utils`.
19
+ - **Good**: `src/features/auth`, `src/features/payment`.
@@ -0,0 +1,11 @@
1
+ # Control Flow
2
+
3
+ **Source**: [Type Challenges](https://github.com/type-challenges/type-challenges)
4
+
5
+ ## 1. Discriminated Unions
6
+
7
+ Use a `kind` or `type` literal field to distinguish union members. This allows TypeScript to narrow types automatically in `switch` statements.
8
+
9
+ ## 2. Exhaustiveness Checking
10
+
11
+ When switching on a discriminated union, ensure all cases are covered. Use a `assertNever(x)` helper in the `default` case to catch future additions at compile time.
@@ -0,0 +1,11 @@
1
+ # The Law of TypeScript (Meta)
2
+
3
+ This directory contains the detailed engineering patterns for TypeScript.
4
+
5
+ ## Index
6
+
7
+ - [01-strictness.md](01-strictness.md)
8
+ - [02-immutability.md](02-immutability.md)
9
+ - [03-async.md](03-async.md)
10
+ - [04-design.md](04-design.md)
11
+ - [05-control-flow.md](05-control-flow.md)
@@ -0,0 +1,68 @@
1
+ # The LGTM Knowledge Engineering Workflow
2
+
3
+ This document records the methodology used to create the LGTM engineering standards. It serves as a guide for contributors proposing new principles or modifying existing ones. We do not just "write docs"; we engineer knowledge.
4
+
5
+ ## The 4-Phase Process
6
+
7
+ ### Phase 1: Research & Discovery (The Divergent Phase)
8
+
9
+ _Goal: Gather high-quality raw material._
10
+
11
+ 1. **Canon Review**: Start with established, battle-tested wisdom (SOLID, Pragmatic Programmer, SRE Books).
12
+ 2. **Deep Dive**: Ingest high-density research (Formal Methods, System Dynamics, Control Theory).
13
+ 3. **Source Verification**: Never rely on hearsay. Find the primary source (e.g., Ousterhout, Conway, Brewer).
14
+
15
+ ### Phase 2: Analysis & Synthesis (The Convergent Phase)
16
+
17
+ _Goal: Distill noise into signal._
18
+
19
+ 1. **Deconstruction**: Break monolithic concepts into atomic constituents. (e.g., SOLID -> SRP, OCP, LSP...).
20
+ 2. **Adversarial Critique**: Rigorously question overlaps. "Is Robustness distinct from Resilience?"
21
+ 3. **Filter**: Remove "fluff" and "magic." Focus on First Principles.
22
+
23
+ ### Phase 3: Codification (The Structuring Phase)
24
+
25
+ _Goal: Create the Source of Truth._
26
+
27
+ 1. **The Master Registry (`docs/meta/industry_best_practices.md`)**: Catalog every atomic principle with a Definition, Requirements, and Source.
28
+ 2. **The Abstraction Layer (`docs/engineering_principles.md`)**: Group principles into orthogonal dimensions.
29
+ 3. **The Constitution (`docs/philosophy.md`)**: Synthesize the "Why" into a cohesive narrative.
30
+
31
+ ### Phase 4: Distribution (The Engineering Phase)
32
+
33
+ _Goal: Make it executable._
34
+
35
+ 1. **Atomic Specs (`specs/`)**: Explode the Master Registry into machine-readable Zettelkasten nodes for AI context injection.
36
+ 2. **Separation**: Maintain the Standards (`lgtm-specs`) independently of the Implementation (`opencode-lgtm`).
37
+
38
+ ---
39
+
40
+ ## Validation Checklist
41
+
42
+ Before a principle is adopted:
43
+
44
+ - [ ] **Source**: Is it primary (book, paper, original author)?
45
+ - [ ] **Testable**: Is the definition measurable?
46
+ - [ ] **Orthogonal**: Does it overlap with existing principles?
47
+ - [ ] **Universal**: Is it applicable to at least 2 programming languages?
48
+ - [ ] **Anti-Pattern**: Does it have a clear "What violates this?" example?
49
+
50
+ ---
51
+
52
+ ## Meta-Process: Improving the Workflow
53
+
54
+ This workflow itself evolves.
55
+
56
+ **Quarterly Review**:
57
+
58
+ - Which principles were rejected? Why?
59
+ - Where did agents get stuck?
60
+ - What conflicts arose most?
61
+
62
+ **Change Process**:
63
+ Changes to `workflow.md` require:
64
+
65
+ 1. **RFC** (Request for Comments).
66
+ 2. **2-week trial period**.
67
+ 3. **Retrospective**.
68
+ 4. **Merge or Revert**.
@@ -0,0 +1,36 @@
1
+ # Philosophy
2
+
3
+ This document outlines the core values and mission of the LGTM project.
4
+
5
+ ## 1. The Mission
6
+
7
+ To raise the global standard of software engineering by making **Rigorous Verification** cheaper than **Hasty Implementation**.
8
+
9
+ ## 2. The Core Values
10
+
11
+ ### Truth over Convenience
12
+
13
+ We do not optimize for "Time to First Token." We optimize for "Time to Correctness."
14
+
15
+ - **Implication**: Our agents will refuse to write code if they don't understand the system.
16
+
17
+ ### Structure over Speed
18
+
19
+ We believe that rigorous structure is the fastest way to build complex systems.
20
+
21
+ - **Implication**: We enforce Zettelkasten, Atomic Commits, and Strict Capabilities.
22
+ - **Definition**: Every agent declares a `Capability` that the runtime uses to resolve a model from `models/registry.yaml`.
23
+
24
+ ### Machines over Humans (for Rote Work)
25
+
26
+ Humans should focus on **Germane Load** (Learning, Strategy). Machines should handle **Extraneous Load** (Formatting, Imports, Context Switching).
27
+
28
+ - **Implication**: If a machine can check it, a human shouldn't have to.
29
+
30
+ ## 3. The Implementation Strategy
31
+
32
+ We implement these values through a **Knowledge Graph** architecture.
33
+
34
+ - **Zettelkasten**: Rules are atomic nodes (e.g., `CONS-00015-safety.md`).
35
+ - **RAG**: We inject only relevant nodes into agent context.
36
+ - **Agentic Consensus**: No single agent has the authority to merge code.