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.
- package/.claude/settings.local.json +14 -0
- package/.gemini/README.md +8 -0
- package/.gemini/config.yaml +20 -0
- package/.gemini/styleguide.md +35 -0
- package/.github/workflows/README.md +5 -0
- package/.github/workflows/release.yml +52 -0
- package/.github/workflows/validate.yml +27 -0
- package/.prettierignore +4 -0
- package/.prettierrc +1 -0
- package/AGENTS.md +151 -0
- package/README.md +98 -0
- package/VERSION +1 -0
- package/agents/README.md +73 -0
- package/agents/modes/README.md +9 -0
- package/agents/modes/build.md +88 -0
- package/agents/modes/hack.md +76 -0
- package/agents/modes/review.md +79 -0
- package/agents/roles/builder.md +75 -0
- package/agents/roles/counsel.md +96 -0
- package/agents/roles/explorer.md +77 -0
- package/agents/roles/lead.md +76 -0
- package/agents/roles/librarian.md +63 -0
- package/agents/roles/planner.md +75 -0
- package/agents/roles/reviewer/BASE.md +9 -0
- package/agents/roles/reviewer/OUTPUT_FORMAT.md +4 -0
- package/agents/roles/reviewer/README.md +48 -0
- package/agents/roles/reviewer/lite.md +51 -0
- package/agents/roles/reviewer/logic.md +48 -0
- package/agents/roles/reviewer/performance.md +45 -0
- package/agents/roles/reviewer/plan.md +52 -0
- package/agents/roles/reviewer/quality.md +49 -0
- package/agents/roles/reviewer/security.md +47 -0
- package/agents/roles/reviewer/test.md +48 -0
- package/agents/templates/README.md +6 -0
- package/agents/templates/mode.md +33 -0
- package/agents/templates/role.md +73 -0
- package/contribute/README.md +24 -0
- package/contribute/add-agent.md +29 -0
- package/contribute/add-ci.md +31 -0
- package/contribute/add-constitution.md +17 -0
- package/contribute/add-law.md +20 -0
- package/contribute/add-policy.md +27 -0
- package/contribute/checklist.md +42 -0
- package/contribute/maintenance.md +19 -0
- package/contribute/update-models.md +47 -0
- package/docs/README.md +13 -0
- package/docs/adr/0001-knowledge-engineering-workflow.md +22 -0
- package/docs/adr/0002-rule-hierarchy.md +25 -0
- package/docs/adr/0003-atomic-knowledge-graph.md +21 -0
- package/docs/adr/0004-identification-schema.md +22 -0
- package/docs/adr/0005-agent-specialization.md +39 -0
- package/docs/adr/0006-git-workflow-integrity.md +34 -0
- package/docs/adr/0007-operating-modes-and-gates.md +54 -0
- package/docs/adr/0008-rules-vs-workflows-boundary.md +64 -0
- package/docs/adr/README.md +14 -0
- package/docs/agent_architecture.md +164 -0
- package/docs/context_lifecycle.md +228 -0
- package/docs/engineering_principles.md +128 -0
- package/docs/local_policies.md +59 -0
- package/docs/meta/collaborative_dynamics.md +142 -0
- package/docs/meta/domains/README.md +8 -0
- package/docs/meta/domains/bitcoin/01-units.md +21 -0
- package/docs/meta/domains/bitcoin/02-broadcast-cancellation.md +20 -0
- package/docs/meta/domains/bitcoin/03-fee-rates-rounding.md +21 -0
- package/docs/meta/domains/bitcoin/04-confirmations-reorgs.md +20 -0
- package/docs/meta/domains/bitcoin/05-address-gap-limit.md +16 -0
- package/docs/meta/domains/bitcoin/06-relay-policy.md +27 -0
- package/docs/meta/domains/bitcoin/README.md +12 -0
- package/docs/meta/domains/git/01-workflow.md +89 -0
- package/docs/meta/domains/git/02-commits.md +57 -0
- package/docs/meta/domains/git/03-collaboration.md +40 -0
- package/docs/meta/domains/git/04-integrity.md +26 -0
- package/docs/meta/domains/git/05-configuration.md +209 -0
- package/docs/meta/domains/git/06-advanced.md +130 -0
- package/docs/meta/domains/git/README.md +29 -0
- package/docs/meta/industry_best_practices.md +555 -0
- package/docs/meta/languages/README.md +8 -0
- package/docs/meta/languages/go/01-concurrency.md +37 -0
- package/docs/meta/languages/go/02-api-design.md +30 -0
- package/docs/meta/languages/go/03-resilience.md +27 -0
- package/docs/meta/languages/go/04-errors.md +27 -0
- package/docs/meta/languages/go/05-performance.md +18 -0
- package/docs/meta/languages/go/06-safety.md +18 -0
- package/docs/meta/languages/go/07-testing.md +44 -0
- package/docs/meta/languages/go/08-config-layout.md +23 -0
- package/docs/meta/languages/go/README.md +14 -0
- package/docs/meta/languages/typescript/01-strictness.md +19 -0
- package/docs/meta/languages/typescript/02-immutability.md +15 -0
- package/docs/meta/languages/typescript/03-async.md +18 -0
- package/docs/meta/languages/typescript/04-design.md +19 -0
- package/docs/meta/languages/typescript/05-control-flow.md +11 -0
- package/docs/meta/languages/typescript/README.md +11 -0
- package/docs/meta/workflow.md +68 -0
- package/docs/philosophy.md +36 -0
- package/integrate/README.md +459 -0
- package/integrate/versioning.md +41 -0
- package/models/README.md +68 -0
- package/models/registry.yaml +55 -0
- package/package.json +11 -0
- package/rules/README.md +57 -0
- package/rules/RULE-00000-EXAMPLE.md +29 -0
- package/rules/constitution/CONS-00001-srp.md +40 -0
- package/rules/constitution/CONS-00002-ocp.md +43 -0
- package/rules/constitution/CONS-00003-lsp.md +44 -0
- package/rules/constitution/CONS-00004-isp.md +46 -0
- package/rules/constitution/CONS-00005-dip.md +37 -0
- package/rules/constitution/CONS-00006-dry.md +45 -0
- package/rules/constitution/CONS-00007-demeter.md +35 -0
- package/rules/constitution/CONS-00008-composition.md +44 -0
- package/rules/constitution/CONS-00009-deep-modules.md +39 -0
- package/rules/constitution/CONS-00010-kiss.md +47 -0
- package/rules/constitution/CONS-00011-yagni.md +49 -0
- package/rules/constitution/CONS-00012-cognitive-limits.md +28 -0
- package/rules/constitution/CONS-00013-boy-scout.md +27 -0
- package/rules/constitution/CONS-00014-broken-windows.md +35 -0
- package/rules/constitution/CONS-00015-safety.md +46 -0
- package/rules/constitution/CONS-00016-cqs.md +39 -0
- package/rules/constitution/CONS-00017-postel.md +35 -0
- package/rules/constitution/CONS-00018-cap.md +35 -0
- package/rules/constitution/CONS-00019-fallacies.md +37 -0
- package/rules/constitution/CONS-00020-shift-left.md +28 -0
- package/rules/constitution/CONS-00021-congruence.md +28 -0
- package/rules/constitution/CONS-00022-orthogonality.md +40 -0
- package/rules/constitution/CONS-00023-determinism.md +38 -0
- package/rules/constitution/CONS-00024-security.md +42 -0
- package/rules/constitution/CONS-00025-efficiency.md +38 -0
- package/rules/constitution/CONS-00026-resilience.md +41 -0
- package/rules/constitution/CONS-00027-transparency.md +40 -0
- package/rules/constitution/CONS-00028-evolvability.md +36 -0
- package/rules/constitution/CONS-00029-operability.md +36 -0
- package/rules/constitution/CONS-00030-rework-cycle.md +27 -0
- package/rules/constitution/CONS-00031-checklist.md +28 -0
- package/rules/constitution/CONS-00032-documentation.md +39 -0
- package/rules/constitution/README.md +52 -0
- package/rules/laws/README.md +15 -0
- package/rules/laws/bitcoin/BTC-00001-amounts-as-satoshis.md +39 -0
- package/rules/laws/bitcoin/BTC-00002-broadcast-not-cancelable.md +36 -0
- package/rules/laws/bitcoin/BTC-00003-fee-rate-math-rounding.md +37 -0
- package/rules/laws/bitcoin/BTC-00004-confirmations-and-reorgs.md +40 -0
- package/rules/laws/bitcoin/BTC-00005-address-gap-limit.md +37 -0
- package/rules/laws/bitcoin/BTC-00006-relay-is-policy-dependent.md +36 -0
- package/rules/laws/bitcoin/BTC-00007-dust-policy.md +36 -0
- package/rules/laws/bitcoin/BTC-00008-min-relay-fee.md +36 -0
- package/rules/laws/bitcoin/BTC-00009-feefilter.md +36 -0
- package/rules/laws/bitcoin/README.md +29 -0
- package/rules/laws/default.md +30 -0
- package/rules/laws/git/GIT-00001-atomic-commit.md +29 -0
- package/rules/laws/git/GIT-00002-imperative-subject.md +27 -0
- package/rules/laws/git/GIT-00003-formatting-50-72.md +28 -0
- package/rules/laws/git/GIT-00004-trunk-based.md +28 -0
- package/rules/laws/git/GIT-00005-public-immutability.md +26 -0
- package/rules/laws/git/GIT-00006-signing.md +27 -0
- package/rules/laws/git/GIT-00007-reviewer-capital.md +26 -0
- package/rules/laws/git/GIT-00008-patch-series.md +28 -0
- package/rules/laws/git/GIT-00009-branch-naming.md +28 -0
- package/rules/laws/git/GIT-00010-pr-hygiene.md +51 -0
- package/rules/laws/git/GIT-00011-merge-method.md +35 -0
- package/rules/laws/git/GIT-00012-conflict-resolution.md +35 -0
- package/rules/laws/git/GIT-00013-ignore-standards.md +38 -0
- package/rules/laws/git/GIT-00014-lfs-large-binaries.md +37 -0
- package/rules/laws/git/GIT-00015-git-hooks.md +35 -0
- package/rules/laws/git/GIT-00016-branch-protection.md +34 -0
- package/rules/laws/git/GIT-00017-secrets-management.md +34 -0
- package/rules/laws/git/GIT-00018-ci-enforcement.md +33 -0
- package/rules/laws/git/GIT-00019-review-checklist.md +39 -0
- package/rules/laws/git/GIT-00020-issue-references.md +34 -0
- package/rules/laws/git/GIT-00021-partial-staging.md +38 -0
- package/rules/laws/git/GIT-00022-feature-flags.md +33 -0
- package/rules/laws/git/GIT-00023-breaking-changes.md +41 -0
- package/rules/laws/git/GIT-00024-dependency-management.md +44 -0
- package/rules/laws/git/GIT-00025-large-repository-optimization.md +54 -0
- package/rules/laws/git/README.md +31 -0
- package/rules/laws/go/GO-00001-actor-model.md +51 -0
- package/rules/laws/go/GO-00002-api-design.md +37 -0
- package/rules/laws/go/GO-00003-error-handling.md +43 -0
- package/rules/laws/go/GO-00004-context.md +45 -0
- package/rules/laws/go/GO-00005-performance.md +40 -0
- package/rules/laws/go/GO-00006-packages.md +29 -0
- package/rules/laws/go/GO-00007-circuit-breakers.md +43 -0
- package/rules/laws/go/GO-00008-safety.md +39 -0
- package/rules/laws/go/GO-00009-table-driven-test.md +48 -0
- package/rules/laws/go/GO-00010-escape-analysis.md +37 -0
- package/rules/laws/go/GO-00011-retry.md +45 -0
- package/rules/laws/go/GO-00012-rate-limiting.md +42 -0
- package/rules/laws/go/GO-00013-io-buffering.md +43 -0
- package/rules/laws/go/GO-00014-memory-layout.md +41 -0
- package/rules/laws/go/GO-00015-aaa-pattern.md +49 -0
- package/rules/laws/go/GO-00016-test-libraries.md +35 -0
- package/rules/laws/go/GO-00017-comments.md +37 -0
- package/rules/laws/go/GO-00018-test-isolation.md +38 -0
- package/rules/laws/go/GO-00019-test-comments.md +36 -0
- package/rules/laws/go/GO-00020-mocking.md +36 -0
- package/rules/laws/go/GO-00021-configuration.md +36 -0
- package/rules/laws/go/GO-00022-observability.md +34 -0
- package/rules/laws/go/GO-00023-dependency-management.md +28 -0
- package/rules/laws/go/GO-00024-project-layout.md +30 -0
- package/rules/laws/go/GO-00025-concurrency-patterns.md +39 -0
- package/rules/laws/go/README.md +45 -0
- package/rules/laws/typescript/README.md +14 -0
- package/rules/laws/typescript/TS-00001-no-any.md +39 -0
- package/rules/laws/typescript/TS-00002-immutability.md +36 -0
- package/rules/laws/typescript/TS-00003-async.md +35 -0
- package/rules/laws/typescript/TS-00004-strict-null.md +38 -0
- package/rules/laws/typescript/TS-00005-unions.md +35 -0
- package/rules/laws/typescript/TS-00006-interface.md +38 -0
- package/rules/laws/typescript/TS-00007-generics.md +38 -0
- package/rules/laws/typescript/TS-00008-modules.md +28 -0
- package/rules/policies/README.md +12 -0
- package/rules/policies/default.md +28 -0
- package/scripts/README.md +45 -0
- package/scripts/generate_release_notes.py +376 -0
- package/scripts/validate_specs.py +730 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
# Integration Protocol
|
|
2
|
+
|
|
3
|
+
**Spec Version**: 0.0.4
|
|
4
|
+
|
|
5
|
+
This document defines how external tools (like `opencode-lgtm`) must consume this Knowledge Graph.
|
|
6
|
+
|
|
7
|
+
Versioning: see `integrate/versioning.md`.
|
|
8
|
+
|
|
9
|
+
## 1. Directory Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
lgtm-specs/
|
|
13
|
+
├── rules/
|
|
14
|
+
│ ├── README.md # Master index
|
|
15
|
+
│ ├── constitution/ # CONS-XXXXX (Universal)
|
|
16
|
+
│ ├── laws/ # DOMAIN-XXXXX (Domain)
|
|
17
|
+
│ │ └── go/
|
|
18
|
+
│ │ └── README.md # Domain index
|
|
19
|
+
│ └── policies/ # Project policies (default.md, [project]-policy.md)
|
|
20
|
+
├── agents/ # Agent specifications
|
|
21
|
+
├── models/
|
|
22
|
+
│ └── registry.yaml # Model capability mapping
|
|
23
|
+
└── integrate/
|
|
24
|
+
├── README.md # This document
|
|
25
|
+
└── versioning.md # Spec versioning
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 2. The Context Injection (Index Loading)
|
|
29
|
+
|
|
30
|
+
Tools must implement the **Counsel Logic** dynamically.
|
|
31
|
+
|
|
32
|
+
1. **Detect**: Identify all relevant domains present in the project (languages + tooling).
|
|
33
|
+
- Projects may be multi-language (monorepos).
|
|
34
|
+
2. **Load**: Load the Domain Index for each detected domain (e.g., `rules/laws/go/README.md`, `rules/laws/typescript/README.md`).
|
|
35
|
+
3. **Inject**: Provide the loaded index content to the `@Counsel` agent's `{{indices}}` placeholder.
|
|
36
|
+
|
|
37
|
+
Policy resolution:
|
|
38
|
+
|
|
39
|
+
- If the user's repo contains `.lgtm/policies/README.md`, include it as the Primary local Policy path.
|
|
40
|
+
- Otherwise include `rules/policies/default.md`.
|
|
41
|
+
|
|
42
|
+
Notes:
|
|
43
|
+
|
|
44
|
+
- Tools SHOULD treat `.lgtm/policies/README.md` as the local policy index/summary and avoid injecting a large number of
|
|
45
|
+
local policy note files by default.
|
|
46
|
+
|
|
47
|
+
## 3. The Agent Builder (Rule Loading)
|
|
48
|
+
|
|
49
|
+
Tools must parse `agents/**/*.md` and inject full rule content into the agent prompt.
|
|
50
|
+
|
|
51
|
+
### Step 1: Parse Agent Spec Sections
|
|
52
|
+
|
|
53
|
+
Extract sections:
|
|
54
|
+
`<Meta>`, `<Role>`, `<SubAgents>`, `<InjectedSubAgents>`, `<Input>`, `<Context>`, `<Indices>`, `<InjectedRules>`,
|
|
55
|
+
`<Objective>`, `<OutputFormat>`, `<Workflow>`, `<Constraints>`.
|
|
56
|
+
|
|
57
|
+
- **Tag Matching**: Section tags may be indented; match opening/closing tags with optional leading whitespace.
|
|
58
|
+
- **Missing Sections**: If a section tag is absent, treat it as empty.
|
|
59
|
+
- **Required Placeholder**: If a tool intends to inject rules, the agent spec MUST contain a literal `{{injected_rules}}`.
|
|
60
|
+
|
|
61
|
+
Prompt construction categories:
|
|
62
|
+
|
|
63
|
+
- **Tool metadata (strip)**: `<Meta>`
|
|
64
|
+
- **Tool schema (strip)**: `<Input>`
|
|
65
|
+
- **Template containers (keep wrapper)**: `<InjectedRules>`, `<Indices>`, `<InjectedSubAgents>`
|
|
66
|
+
- **LLM-facing (keep)**: all other sections
|
|
67
|
+
|
|
68
|
+
`<Meta>` format:
|
|
69
|
+
|
|
70
|
+
- Key lines MUST start at column 1 and match: `^[A-Za-z][A-Za-z0-9_-]*:(\s.*)?$`.
|
|
71
|
+
- Key names are single tokens (no spaces).
|
|
72
|
+
- Values may be multi-line.
|
|
73
|
+
- Start a block value with `Key:` and put continuation lines on the following lines (often as markdown bullets).
|
|
74
|
+
- Block values end at the next key line (regex match) or the end of `<Meta>`.
|
|
75
|
+
- Lines inside a block may contain `:` (including trailing `:`); treat them as value lines unless they match the key
|
|
76
|
+
regex. Example: `Critical-path heuristics (informational only):` is a value line.
|
|
77
|
+
- Required: `Capability: <capability-id>` for role agents.
|
|
78
|
+
- Common keys (modes): `Type`, `Brain`, `Trigger`, `Team`, `SafetyProfile`.
|
|
79
|
+
- Common keys (roles): `Capability`, `Trigger`, `RuleRender`, `RuleScope`.
|
|
80
|
+
- `Trigger` is informational metadata. For modes, the canonical trigger list lives in the mode spec `<Meta>`.
|
|
81
|
+
- `RuleRender` values: `full` | `trimmed` | `none` | `arbitration-full`.
|
|
82
|
+
- `RuleRender` semantics:
|
|
83
|
+
- `full`: inject the full rule body (including `## Examples`).
|
|
84
|
+
- `trimmed`: inject the rule body without `## Examples`.
|
|
85
|
+
- `none`: do not inject rules.
|
|
86
|
+
- `arbitration-full`: inject full rule bodies only for contested rules during arbitration.
|
|
87
|
+
- `RuleScope` values: `step` | `plan`.
|
|
88
|
+
- `RuleScope` semantics:
|
|
89
|
+
- `step`: inject only the rules referenced by the current plan step.
|
|
90
|
+
- `plan`: inject all selected rules for the plan/review.
|
|
91
|
+
- Default: `plan` when unspecified.
|
|
92
|
+
|
|
93
|
+
Section semantics (prompt construction):
|
|
94
|
+
|
|
95
|
+
| Section | Category | Include in LLM prompt? | Notes |
|
|
96
|
+
| --------------------- | ------------------ | ---------------------- | ----------------------------------------------------------------------------------------------- |
|
|
97
|
+
| `<Meta>` | Tool metadata | No | Parse for orchestration/model selection, then strip. |
|
|
98
|
+
| `<Role>` | LLM-facing | Yes | Persona/identity/strategy (roles) or goal (modes). |
|
|
99
|
+
| `<SubAgents>` | LLM-facing | Lead only | Agent catalog for orchestration. |
|
|
100
|
+
| `<InjectedSubAgents>` | Template container | Lead only | Replace `{{subagents}}` allowlist when provided. |
|
|
101
|
+
| `<Input>` | Tool schema | No | Runtime fills an Input Packet per invocation; omit `<Input>` from the system prompt by default. |
|
|
102
|
+
| `<Context>` | LLM-facing | Optional | Focus/boundaries/background. |
|
|
103
|
+
| `<Indices>` | Template container | Counsel only | Replace `{{indices}}`; keep wrapper. |
|
|
104
|
+
| `<InjectedRules>` | Template container | Yes | Replace `{{injected_rules}}`; keep wrapper. |
|
|
105
|
+
| `<Objective>` | LLM-facing | Yes | Required for role agents; optional for mode specs. |
|
|
106
|
+
| `<OutputFormat>` | LLM-facing | Yes | Required for role agents; optional for mode specs. |
|
|
107
|
+
| `<Workflow>` | LLM-facing | Yes | Required. |
|
|
108
|
+
| `<Constraints>` | LLM-facing | Optional | Strongly recommended. |
|
|
109
|
+
|
|
110
|
+
Input Packet (invocation-time context):
|
|
111
|
+
|
|
112
|
+
- Tools MUST provide the agent's actual inputs at invocation time (as a filled key/value block).
|
|
113
|
+
- Tools SHOULD include the filled Input Packet and omit the agent spec `<Input>` section from the system prompt.
|
|
114
|
+
- For large payloads (filtered diffs), tools SHOULD prefer providing a ready-to-run `Diff Command` over inlining.
|
|
115
|
+
- `Diff Command` MUST return a filtered diff excluding generated files.
|
|
116
|
+
- If an agent expects a diff (`Diff`/`Diff Command` inputs), tools MUST provide at least one of `Diff` or
|
|
117
|
+
`Diff Command`.
|
|
118
|
+
|
|
119
|
+
### Step 2: Strip Rule Metadata
|
|
120
|
+
|
|
121
|
+
When injecting a Rule (Law/Constitution), remove the Header Section.
|
|
122
|
+
|
|
123
|
+
- **Algorithm**: Remove everything _before_ the first `## Definition` header. Keep everything from `## Definition` onward.
|
|
124
|
+
- **Rule IDs**: Tools SHOULD prefix each injected rule with `### <RULE-ID>` for traceability.
|
|
125
|
+
|
|
126
|
+
### Step 3: Render Rules
|
|
127
|
+
|
|
128
|
+
Tools SHOULD support role-dependent rule rendering to reduce prompt cost:
|
|
129
|
+
|
|
130
|
+
- **Full**: `## Definition` + `## Requirements` + `## Anti-Patterns` + `## Examples`
|
|
131
|
+
- **Trimmed**: `## Definition` + `## Requirements` + `## Anti-Patterns` (strip `## Examples`)
|
|
132
|
+
- **Algorithm**: For trimmed rendering, remove everything from the `## Examples` header onward.
|
|
133
|
+
- **Default mapping**:
|
|
134
|
+
- Builder: Full.
|
|
135
|
+
- Planner: Trimmed.
|
|
136
|
+
- Reviewers: Trimmed.
|
|
137
|
+
- Lead: None during orchestration; during arbitration, Full for contested rules only.
|
|
138
|
+
|
|
139
|
+
Arbitration invocations (Lead):
|
|
140
|
+
|
|
141
|
+
- Tools MUST distinguish normal `@Lead` orchestration from arbitration.
|
|
142
|
+
- Normal orchestration: inject no rules into `@Lead`.
|
|
143
|
+
- Arbitration: when the selected mode enters an arbitration step (or `@Lead` requests arbitration), tools MUST re-invoke
|
|
144
|
+
`@Lead` with:
|
|
145
|
+
- a minimal Tier 2 diff snippet for the contested lines, and
|
|
146
|
+
- full rule bodies for the contested rule set only.
|
|
147
|
+
|
|
148
|
+
Tools MAY override defaults using agent `<Meta>` keys (`RuleRender`, `RuleScope`).
|
|
149
|
+
|
|
150
|
+
### Step 4: Template Placeholders
|
|
151
|
+
|
|
152
|
+
Replace placeholders like `{{injected_rules}}` with the stripped/rendered content.
|
|
153
|
+
|
|
154
|
+
- Tools MUST expand placeholders anywhere they appear (not just inside `<InjectedRules>`).
|
|
155
|
+
|
|
156
|
+
- **Contract**: Worker agents that require rules MUST include a literal `{{injected_rules}}` placeholder in their spec.
|
|
157
|
+
- **Empty Injection**: If no rules are available, replace `{{injected_rules}}` with an empty string.
|
|
158
|
+
- **Empty Containers**: If a template-container section becomes empty/whitespace after replacement, tools SHOULD drop the wrapper tags.
|
|
159
|
+
- **SubAgents (Optional)**: Tools MAY inject an allowlist into `{{subagents}}` for orchestration control.
|
|
160
|
+
- Semantics: After templating, if `<InjectedSubAgents>` is empty/whitespace, the Lead may use the full `<SubAgents>` catalog.
|
|
161
|
+
|
|
162
|
+
Shared blocks:
|
|
163
|
+
|
|
164
|
+
- Tools MUST support shared-block placeholders used by this repo's agent specs.
|
|
165
|
+
- `{{reviewer_base_constraints}}` -> `agents/roles/reviewer/BASE.md`
|
|
166
|
+
- `{{reviewer_output_format}}` -> `agents/roles/reviewer/OUTPUT_FORMAT.md`
|
|
167
|
+
- Tools MAY support additional placeholders for shared prompt fragments.
|
|
168
|
+
- Shared fragments are Markdown snippets (not full agent specs).
|
|
169
|
+
- If a placeholder is present in a prompt, tools MUST NOT leave it unexpanded.
|
|
170
|
+
|
|
171
|
+
### Step 5: Execute
|
|
172
|
+
|
|
173
|
+
Send the composed system prompt to the LLM.
|
|
174
|
+
|
|
175
|
+
Avoid duplicate rule context:
|
|
176
|
+
|
|
177
|
+
- Tools SHOULD NOT include both:
|
|
178
|
+
1. the selected-rule list (paths/reasons), and
|
|
179
|
+
2. the hydrated rule text blocks,
|
|
180
|
+
in the same agent prompt.
|
|
181
|
+
- Keep Counsel's JSON output in tool logs and inject only stripped rule bodies via `{{injected_rules}}`.
|
|
182
|
+
- If the LLM must reference specific rules, include a compact list of injected rule IDs (IDs only) or prefix each injected rule body with
|
|
183
|
+
`### <RULE-ID>`; avoid full paths and rule header metadata.
|
|
184
|
+
|
|
185
|
+
## 4. The Model Resolver
|
|
186
|
+
|
|
187
|
+
Tools must resolve the Agent's **Capability Requirement** to a specific model ID.
|
|
188
|
+
|
|
189
|
+
- **Input**: Agent Spec `<Meta>` contains `Capability: <capability-id>`.
|
|
190
|
+
- `<capability-id>` must match a key under `capabilities` in `models/registry.yaml`.
|
|
191
|
+
- Valid capability IDs: `reasoning`, `coding`, `data`, `fast`, `security`, `docs`, `general`.
|
|
192
|
+
- **Lookup**: `models/registry.yaml` -> `capabilities.<name>` -> candidate list.
|
|
193
|
+
- **Selection**:
|
|
194
|
+
1. **Iterate**: Check each model in the candidate list in order.
|
|
195
|
+
2. **Availability**: Select the first model that is available.
|
|
196
|
+
- The registry list order is the preference order.
|
|
197
|
+
|
|
198
|
+
### Availability Detection
|
|
199
|
+
|
|
200
|
+
Tools must define and document how availability is determined.
|
|
201
|
+
|
|
202
|
+
Minimum requirement:
|
|
203
|
+
|
|
204
|
+
- Treat a model as available only if the provider access is configured and the model can be invoked.
|
|
205
|
+
- Availability checks should be deterministic within a single run (cache results).
|
|
206
|
+
|
|
207
|
+
Tools MUST document their availability mechanism and MUST treat missing credentials/config as unavailable.
|
|
208
|
+
|
|
209
|
+
Minimum mechanism (environment variable convention):
|
|
210
|
+
|
|
211
|
+
1. Derive provider from the model ID prefix before `/` (e.g., `openai/gpt-5.2` -> `openai`).
|
|
212
|
+
2. Require an API key in `${PROVIDER_UPPER}_API_KEY`.
|
|
213
|
+
- Example: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `MINIMAX_API_KEY`, `MOONSHOTAI_API_KEY`, `QWEN_API_KEY`.
|
|
214
|
+
- For `moonshotai/*`, `${PROVIDER_UPPER}` is `MOONSHOTAI`.
|
|
215
|
+
3. If the key is missing, treat the provider (and its models) as unavailable.
|
|
216
|
+
|
|
217
|
+
Runtime failover:
|
|
218
|
+
|
|
219
|
+
- If a model invocation fails due to authentication/permission errors, treat the provider as unavailable for the rest of the run.
|
|
220
|
+
- If a model invocation fails due to transient network errors or rate limits, treat that model as unavailable for the rest of the run and try the next candidate.
|
|
221
|
+
- Cache availability/failure decisions for the duration of the run.
|
|
222
|
+
|
|
223
|
+
Optional preflight (non-inference):
|
|
224
|
+
|
|
225
|
+
- If the provider exposes a lightweight model listing / ping endpoint, tools MAY use it to confirm credentials before first inference.
|
|
226
|
+
|
|
227
|
+
Fallback:
|
|
228
|
+
|
|
229
|
+
- If no model in the specific capability list is available, tools SHOULD FAIL by default.
|
|
230
|
+
- Tools MAY fall back to `capabilities.general` only if they can guarantee the selected model can satisfy the required capability; tools MUST emit an explicit warning when using a fallback.
|
|
231
|
+
|
|
232
|
+
Workflow invariance:
|
|
233
|
+
|
|
234
|
+
- Model availability must not change workflow semantics.
|
|
235
|
+
- Do not reduce the number of reviewers or gates due to model unavailability.
|
|
236
|
+
|
|
237
|
+
## 5. Context Limits
|
|
238
|
+
|
|
239
|
+
- **Max Rules**: Inject maximum **10** most relevant rules per agent.
|
|
240
|
+
- **Counsel Output**: Counsel SHOULD target <= 10 paths and MUST cap at <= 15 paths; tools MUST down-select to <= 10 per
|
|
241
|
+
agent.
|
|
242
|
+
- **Relevance**: Determined by the rule paths returned by Counsel (plus any mandatory policy rules).
|
|
243
|
+
- **Truncation**: If content exceeds model context window:
|
|
244
|
+
1. Truncate **Examples** first.
|
|
245
|
+
2. Keep **Requirements** and **Definition** at all costs.
|
|
246
|
+
|
|
247
|
+
### Non-Rule Context Budget
|
|
248
|
+
|
|
249
|
+
Large artifacts (diffs, long logs) should only be sent to agents that need them.
|
|
250
|
+
Avoid relaying the full diff through multiple agent contexts.
|
|
251
|
+
|
|
252
|
+
Git context tiers:
|
|
253
|
+
|
|
254
|
+
- **Tier 0 (Intent)**: commit subjects (and bodies when needed).
|
|
255
|
+
- **Tier 1 (Scope)**: file manifest (added/modified/deleted) + size stats.
|
|
256
|
+
- **Tier 2 (Review)**: filtered diff for human-authored files only.
|
|
257
|
+
|
|
258
|
+
Tools SHOULD NOT make agents guess git commands.
|
|
259
|
+
When an agent must fetch git context, the runtime MUST provide explicit commands in the filled Input Packet.
|
|
260
|
+
|
|
261
|
+
Prompt caching (optional optimization):
|
|
262
|
+
|
|
263
|
+
- If a provider supports prompt caching, tools SHOULD batch reviewers by provider and keep a shared prefix stable.
|
|
264
|
+
- Put shared content first (mode + request + filtered diff + shared rules), then append reviewer-specific instructions.
|
|
265
|
+
|
|
266
|
+
Recommended minimum inputs:
|
|
267
|
+
|
|
268
|
+
| Agent | Provide | Avoid |
|
|
269
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------- |
|
|
270
|
+
| Explorer | `Query` + `Scope`; optional `Change Manifest` | Full diff content |
|
|
271
|
+
| Counsel | `Task` + Context Map (Summary Map with domains/policies); optional `Change Manifest` | Full diff content |
|
|
272
|
+
| Planner | `User Request` + `Mode` + Context Map (Full Map) + injected rules; optional `Change Manifest` | Full diff content |
|
|
273
|
+
| Librarian | Research query + small relevant snippets + versions | Full diff content |
|
|
274
|
+
| Plan-Reviewer | `Plan` + `User Request` + optional refs + optional `Change Manifest` | Full diff content |
|
|
275
|
+
| Reviewer-Lite | `User Request` + (`Diff` or `Diff Command`) + optional `Base Ref`/`Head Ref` + `Commit Message` + injected rules | Large non-atomic diffs |
|
|
276
|
+
| Specialist reviewers | `User Request` + (`Diff` or `Diff Command`) + optional `Base Ref`/`Head Ref` + injected rules | Lockfiles and generated artifacts |
|
|
277
|
+
| Lead | `Request` + `Mode` + `Context` + optional refs + optional `Change Manifest`; structured outputs in/out | Full diff by default |
|
|
278
|
+
|
|
279
|
+
Tier 2 delivery (preferred):
|
|
280
|
+
|
|
281
|
+
- For small diffs: inline `Diff`.
|
|
282
|
+
- For large diffs: provide git `Base Ref`, git `Head Ref`, and a ready-to-run `Diff Command` (already filtered).
|
|
283
|
+
|
|
284
|
+
Canonical commands (examples):
|
|
285
|
+
|
|
286
|
+
- Commit subjects: `git log --format=%s <base>..<head>`
|
|
287
|
+
- File manifest: `git diff --name-status <base>...<head>`
|
|
288
|
+
- Filtered diff: `git diff --no-color <base>...<head> -- <path1> <path2> ...`
|
|
289
|
+
|
|
290
|
+
GitHub metadata (when available):
|
|
291
|
+
|
|
292
|
+
- Include PR title + description for Planner/Lead and specialist reviewers (high signal, low tokens).
|
|
293
|
+
- Include linked issue title + body when referenced (skip long comment threads).
|
|
294
|
+
|
|
295
|
+
Explorer Context Map routing:
|
|
296
|
+
|
|
297
|
+
- Explorer outputs a `Summary Map` and `Full Map`.
|
|
298
|
+
- Tools SHOULD feed:
|
|
299
|
+
- `Summary Map` to Lead and Counsel by default.
|
|
300
|
+
- The `Summary Map` MUST include `Detected Domains` and `Project Policy Files` (mark one as `Primary`) when available.
|
|
301
|
+
- `Full Map` to Planner.
|
|
302
|
+
|
|
303
|
+
### Generated / Auto-Generated Files
|
|
304
|
+
|
|
305
|
+
Auto-generated diffs are high-token and low-signal.
|
|
306
|
+
Tools SHOULD exclude them from reviewer prompts and rely on deterministic tooling for validation.
|
|
307
|
+
|
|
308
|
+
Default exclude patterns (starting point):
|
|
309
|
+
|
|
310
|
+
- Lockfiles: `go.sum`, `package-lock.json`, `yarn.lock`, `bun.lockb`, `pnpm-lock.yaml`, `Cargo.lock`, `Gemfile.lock`, `poetry.lock`, `composer.lock`
|
|
311
|
+
- Common generated markers: files containing `Code generated by` + `DO NOT EDIT`
|
|
312
|
+
- Protobuf/gRPC: `*.pb.go`, `*.pb.ts`, `*_grpc.pb.go`, `*_pb2.py`
|
|
313
|
+
- Go codegen: `*_gen.go`, `*_string.go`, `wire_gen.go`, `mock_*.go`
|
|
314
|
+
- Build output: `dist/`, `build/`, `vendor/` (when committed)
|
|
315
|
+
|
|
316
|
+
Policy extension:
|
|
317
|
+
|
|
318
|
+
- If the target repo has a generated-file policy, tools SHOULD apply it to extend/override the defaults.
|
|
319
|
+
- Even when excluded from review prompts, generated files MUST still be validated by build/lint/test commands.
|
|
320
|
+
|
|
321
|
+
### Three-Level Diff Loading
|
|
322
|
+
|
|
323
|
+
Tools SHOULD avoid loading the unfiltered full diff upfront.
|
|
324
|
+
Prefer graduated loading:
|
|
325
|
+
|
|
326
|
+
1. **Commit log** (intent): subjects + bodies.
|
|
327
|
+
2. **File manifest** (scope): `git diff --name-status` (or `--stat` for Planner).
|
|
328
|
+
3. **Filtered diff** (review): only non-generated, human-authored files.
|
|
329
|
+
|
|
330
|
+
Edge case:
|
|
331
|
+
|
|
332
|
+
- If all changed files are excluded as generated, specialist reviewers should receive an empty filtered diff and output `LGTM`.
|
|
333
|
+
|
|
334
|
+
### Per-Reviewer Diff Scoping (Optional)
|
|
335
|
+
|
|
336
|
+
To keep specialist reviewers focused and reduce token waste, tools MAY provide different filtered diffs per reviewer.
|
|
337
|
+
|
|
338
|
+
Recommended patterns:
|
|
339
|
+
|
|
340
|
+
- `@Reviewer-Logic`: exclude test files and documentation-only changes; focus on runtime/production code.
|
|
341
|
+
- `@Reviewer-Test`: include test file diffs; optionally include a cheap file manifest of production changes.
|
|
342
|
+
- `@Reviewer-Quality`: include human-authored diffs; avoid generated artifacts; emphasize docs/maintainability.
|
|
343
|
+
- `@Reviewer-Security`: include boundary-facing code (auth, input parsing, serialization, access control) and config changes.
|
|
344
|
+
- `@Reviewer-Performance`: include suspected hot paths (loops, allocations, DB/query layer, critical IO paths).
|
|
345
|
+
- `@Reviewer-Lite`: include the smallest atomic diff subset + commit message.
|
|
346
|
+
|
|
347
|
+
If diffs are scoped per reviewer, tools SHOULD still provide a file manifest (Tier 1) so reviewers can detect missing tests
|
|
348
|
+
or review gaps without reading unrelated diffs.
|
|
349
|
+
|
|
350
|
+
### Per-Reviewer Rule Filtering
|
|
351
|
+
|
|
352
|
+
Tools MUST NOT inject all selected rules into every reviewer.
|
|
353
|
+
Inject a role-appropriate subset to preserve prompt budget.
|
|
354
|
+
|
|
355
|
+
Enforcement requirements:
|
|
356
|
+
|
|
357
|
+
- Tools MUST log which rule IDs were injected into each agent prompt (Planner + each reviewer) for traceability.
|
|
358
|
+
- Tools MUST cap injected rules per reviewer (recommended: <= 10).
|
|
359
|
+
- Tools MUST prefer:
|
|
360
|
+
1. rules explicitly selected for that reviewer (by tags), then
|
|
361
|
+
2. Constitution, then
|
|
362
|
+
3. closest-matching domain laws.
|
|
363
|
+
|
|
364
|
+
If a tool cannot classify rules by tags, it MUST fall back to injecting only Constitution + the top-N domain rules rather than injecting everything.
|
|
365
|
+
|
|
366
|
+
### Per-Step Rule Scoping (Builder)
|
|
367
|
+
|
|
368
|
+
For execution plans, the runtime SHOULD scope Builder rule injection to the current plan step.
|
|
369
|
+
|
|
370
|
+
- Planner steps SHOULD list `Requirements` as rule IDs (not rule text).
|
|
371
|
+
- When invoking Builder for step N, inject only:
|
|
372
|
+
- the rules referenced by that step's rule IDs,
|
|
373
|
+
- plus any mandatory policy rules.
|
|
374
|
+
|
|
375
|
+
### Counsel Output Contract (JSON)
|
|
376
|
+
|
|
377
|
+
Counsel MUST return a JSON array of objects:
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
[{ "path": "rules/constitution/CONS-00015-safety.md", "reason": "..." }]
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Note: the code fence here is documentation-only. The `@Counsel` agent output must be raw JSON (no fences).
|
|
384
|
+
|
|
385
|
+
Schema (informal):
|
|
386
|
+
|
|
387
|
+
- Array length: target <= 10 items; hard cap <= 15 items.
|
|
388
|
+
- `path` (string, required): repo-relative path to a rule/policy.
|
|
389
|
+
- `reason` (string, required): why it was selected; may include a re-scan request when Context Map is missing domains.
|
|
390
|
+
- `request` (object, optional): structured runtime request (e.g., `{ "action": "rerun_explorer", "scope": "broader" }`).
|
|
391
|
+
|
|
392
|
+
JSON Schema (Draft-07 compatible):
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
397
|
+
"type": "array",
|
|
398
|
+
"maxItems": 15,
|
|
399
|
+
"items": {
|
|
400
|
+
"type": "object",
|
|
401
|
+
"required": ["path", "reason"],
|
|
402
|
+
"additionalProperties": false,
|
|
403
|
+
"properties": {
|
|
404
|
+
"path": { "type": "string", "minLength": 1 },
|
|
405
|
+
"reason": { "type": "string", "minLength": 1 },
|
|
406
|
+
"request": {
|
|
407
|
+
"type": "object",
|
|
408
|
+
"required": ["action"],
|
|
409
|
+
"additionalProperties": true,
|
|
410
|
+
"properties": {
|
|
411
|
+
"action": { "type": "string" },
|
|
412
|
+
"scope": { "type": "string" }
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Recommended heuristic:
|
|
421
|
+
|
|
422
|
+
- `@Reviewer-Logic`: prioritize correctness/behavior rules (e.g., `#correctness`, `#behavioral`, `#runtime`).
|
|
423
|
+
- `@Reviewer-Test`: prioritize testing rules (e.g., `#testing`, `#tdd`, `#mocking`, `#isolation`).
|
|
424
|
+
- `@Reviewer-Security`: prioritize security rules (e.g., `#security`, `#secrets`, `#defense`, trust-boundary laws).
|
|
425
|
+
- `@Reviewer-Performance`: prioritize performance rules (e.g., `#performance`, `#efficiency`, `#resources`).
|
|
426
|
+
- `@Reviewer-Quality`: prioritize readability/maintainability rules (e.g., `#readability`, `#maintenance`, `#documentation`).
|
|
427
|
+
|
|
428
|
+
If no specialist-relevant rules are available, inject only Constitution + the closest matching laws.
|
|
429
|
+
|
|
430
|
+
Counsel error handling:
|
|
431
|
+
|
|
432
|
+
- If Counsel returns invalid JSON, treat it as a hard error and fall back to Constitution + default policy.
|
|
433
|
+
- If Counsel returns an empty array, fall back to Constitution + default policy.
|
|
434
|
+
- If a returned `path` does not exist, skip it and log an error; if all paths are missing, fall back to Constitution + default policy.
|
|
435
|
+
|
|
436
|
+
## 6. Example Flow (Loading a Go Reviewer)
|
|
437
|
+
|
|
438
|
+
1. **Detect**: Language is `Go`.
|
|
439
|
+
2. **Load Index**: Read `rules/laws/go/README.md`.
|
|
440
|
+
3. **Counsel**: Ask `@Counsel` to select rules. Returns paths.
|
|
441
|
+
```json
|
|
442
|
+
[
|
|
443
|
+
{
|
|
444
|
+
"path": "rules/constitution/CONS-00015-safety.md",
|
|
445
|
+
"reason": "Trust boundary / safety"
|
|
446
|
+
},
|
|
447
|
+
{ "path": "rules/laws/go/GO-00001-...md", "reason": "Go domain detected" }
|
|
448
|
+
]
|
|
449
|
+
```
|
|
450
|
+
4. **Parse Agent**: Read `agents/roles/reviewer/logic.md` and extract `<Meta>` (Capability + RuleRender).
|
|
451
|
+
5. **Load Rules**: Read the returned `path` files.
|
|
452
|
+
6. **Strip**: Remove rule headers (everything before `## Definition`).
|
|
453
|
+
7. **Render**: Apply `RuleRender: trimmed` (strip `## Examples`).
|
|
454
|
+
8. **Inject**: Replace `{{injected_rules}}` with the rendered rule bodies.
|
|
455
|
+
9. **Resolve Model**:
|
|
456
|
+
- Agent `<Meta>` contains `Capability: reasoning`.
|
|
457
|
+
- Tool loads `models/registry.yaml` and reads `capabilities.reasoning`.
|
|
458
|
+
- Tool selects the first available model from the list.
|
|
459
|
+
10. **Execute**: Call API.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Versioning
|
|
2
|
+
|
|
3
|
+
This repository is consumed as a specification database by tools via `integrate/README.md`.
|
|
4
|
+
|
|
5
|
+
## Current Version
|
|
6
|
+
|
|
7
|
+
- Repo version: `0.0.4` (see `VERSION`).
|
|
8
|
+
- Integration spec version: `0.0.4` (see `integrate/README.md`).
|
|
9
|
+
|
|
10
|
+
## How Consumers Pin a Version
|
|
11
|
+
|
|
12
|
+
Recommended: Git tags + GitHub releases.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git tag v0.0.4
|
|
16
|
+
git push origin v0.0.4
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Consumers can fetch a tag tarball:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -L "https://github.com/<owner>/lgtm-specs/archive/refs/tags/v0.0.4.tar.gz" | tar -xz
|
|
23
|
+
|
|
24
|
+
For this repository, `<owner>` is `yyforyongyu`.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Alternative: git submodule.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git submodule add https://github.com/<org>/lgtm-specs.git .lgtm/specs
|
|
31
|
+
git submodule update --init --recursive
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## SemVer Policy
|
|
35
|
+
|
|
36
|
+
This repo is pre-1.0.0; breaking changes are possible in any version bump.
|
|
37
|
+
We still try to follow these targets:
|
|
38
|
+
|
|
39
|
+
- Patch: doc fixes, indexing fixes, typo fixes.
|
|
40
|
+
- Minor: new rules/agents/models that are additive.
|
|
41
|
+
- Major: breaking changes to `integrate/README.md` contracts.
|
package/models/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# The Intelligence Layer
|
|
2
|
+
|
|
3
|
+
This directory defines the **Compute Intelligence** strategy for LGTM (2026 Standard).
|
|
4
|
+
|
|
5
|
+
## The Capability System
|
|
6
|
+
|
|
7
|
+
Agents request **Capabilities**. This allows for specialization (e.g., using a high-context model for retrieval vs. a reasoning model for planning).
|
|
8
|
+
|
|
9
|
+
The order of models within each capability list in `models/registry.yaml` is the preference order.
|
|
10
|
+
|
|
11
|
+
Preference notes:
|
|
12
|
+
|
|
13
|
+
- Models earlier in each capability list are the preferred defaults (first available wins).
|
|
14
|
+
- Lists are grouped by provider preference order (OpenAI -> Anthropic -> Google -> MiniMax -> MoonshotAI -> Qwen).
|
|
15
|
+
- This ordering encodes org preference and operational experience; it is not a claim of global benchmark rank.
|
|
16
|
+
|
|
17
|
+
Capability IDs are lowercase keys under `capabilities` (e.g., `reasoning`, `coding`).
|
|
18
|
+
|
|
19
|
+
### **Reasoning**
|
|
20
|
+
|
|
21
|
+
- **Role**: Planning, Architecture, Deep Logic, Complex Review.
|
|
22
|
+
- **Capabilities**: Chain-of-thought, multi-step reasoning, low hallucination.
|
|
23
|
+
|
|
24
|
+
### **Coding**
|
|
25
|
+
|
|
26
|
+
- **Role**: Implementation, Refactoring, Syntax Correction.
|
|
27
|
+
- **Capabilities**: Strong syntax knowledge, code generation, refactoring patterns.
|
|
28
|
+
|
|
29
|
+
### **Data**
|
|
30
|
+
|
|
31
|
+
- **Role**: Retrieval, Context Mapping, Summarization.
|
|
32
|
+
- **Capabilities**: Massive context window (1M+), recall accuracy.
|
|
33
|
+
|
|
34
|
+
### **Security**
|
|
35
|
+
|
|
36
|
+
- **Role**: Threat Modeling, Vulnerability Scanning.
|
|
37
|
+
- **Capabilities**: Defensive reasoning, high safety bounds.
|
|
38
|
+
|
|
39
|
+
### **Docs**
|
|
40
|
+
|
|
41
|
+
- **Role**: Technical Writing, Release Notes, Stakeholder Comms.
|
|
42
|
+
- **Capabilities**: Structured writing, tone adaptation, empathy.
|
|
43
|
+
|
|
44
|
+
### **Fast**
|
|
45
|
+
|
|
46
|
+
- **Role**: Tool Routing, Quick Checks, Formatting.
|
|
47
|
+
- **Capabilities**: Low latency, high throughput, low cost.
|
|
48
|
+
|
|
49
|
+
### **General**
|
|
50
|
+
|
|
51
|
+
- **Role**: Fallback when no specialist capability model is available.
|
|
52
|
+
- **Capabilities**: Balanced; must be "good enough" across reasoning + coding + retrieval.
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
Agents specify a **Capability Requirement**. The runtime resolves this to a specific model from `registry.yaml`.
|
|
57
|
+
|
|
58
|
+
Resolution Rules:
|
|
59
|
+
|
|
60
|
+
1. **Check Capability List**: Iterate through the models listed for the requested capability.
|
|
61
|
+
2. **Availability**: Pick the first model the user has access to (keys configured).
|
|
62
|
+
3. **Fallback**: If no specialist model is available, fail by default.
|
|
63
|
+
- Tools MAY fall back to `general` only if they can guarantee the selected model can satisfy the required capability.
|
|
64
|
+
- Tools MUST emit an explicit warning when using a fallback.
|
|
65
|
+
|
|
66
|
+
## Contributing
|
|
67
|
+
|
|
68
|
+
To update the registry, read `contribute/update-models.md`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Updated: 2026-02-08
|
|
2
|
+
# Ordering: earlier models are preferred defaults. Lists are grouped by provider
|
|
3
|
+
# preference order: openai -> anthropic -> google -> minimax -> moonshotai -> qwen.
|
|
4
|
+
|
|
5
|
+
capabilities:
|
|
6
|
+
reasoning:
|
|
7
|
+
- openai/gpt-5.2
|
|
8
|
+
- anthropic/claude-opus-4.6
|
|
9
|
+
- anthropic/claude-opus-4.5
|
|
10
|
+
- google/gemini-3-pro-preview
|
|
11
|
+
- minimax/minimax-m2.1
|
|
12
|
+
- moonshotai/kimi-k2.5
|
|
13
|
+
|
|
14
|
+
coding:
|
|
15
|
+
- openai/gpt-5.2-codex
|
|
16
|
+
- openai/gpt-5.2
|
|
17
|
+
- anthropic/claude-sonnet-4.5
|
|
18
|
+
- google/gemini-3-flash-preview
|
|
19
|
+
- minimax/minimax-m2.1
|
|
20
|
+
- qwen/qwen3-coder
|
|
21
|
+
|
|
22
|
+
data:
|
|
23
|
+
- openai/gpt-5.2
|
|
24
|
+
- anthropic/claude-opus-4.6
|
|
25
|
+
- anthropic/claude-opus-4.5
|
|
26
|
+
- google/gemini-3-pro-preview
|
|
27
|
+
- minimax/minimax-m2.1
|
|
28
|
+
- moonshotai/kimi-k2.5
|
|
29
|
+
|
|
30
|
+
security:
|
|
31
|
+
- openai/gpt-5.2
|
|
32
|
+
- anthropic/claude-opus-4.6
|
|
33
|
+
- anthropic/claude-opus-4.5
|
|
34
|
+
- google/gemini-3-pro-preview
|
|
35
|
+
- minimax/minimax-m2.1
|
|
36
|
+
|
|
37
|
+
docs:
|
|
38
|
+
- openai/gpt-5.2
|
|
39
|
+
- anthropic/claude-sonnet-4.5
|
|
40
|
+
- anthropic/claude-opus-4.5
|
|
41
|
+
- google/gemini-3-pro-preview
|
|
42
|
+
- minimax/minimax-m2.1
|
|
43
|
+
|
|
44
|
+
fast:
|
|
45
|
+
- openai/gpt-4o-mini
|
|
46
|
+
- anthropic/claude-haiku-4.5
|
|
47
|
+
- google/gemini-3-flash-preview
|
|
48
|
+
- google/gemini-2.5-flash
|
|
49
|
+
- minimax/minimax-m2.1
|
|
50
|
+
|
|
51
|
+
general:
|
|
52
|
+
- openai/gpt-5.2
|
|
53
|
+
- anthropic/claude-sonnet-4.5
|
|
54
|
+
- google/gemini-3-pro-preview
|
|
55
|
+
- minimax/minimax-m2.1
|
package/package.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lgtm-specs",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Validation and formatting commands for LGTM specs.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"validate": "python3 scripts/validate_specs.py",
|
|
7
|
+
"format": "bunx prettier --write .",
|
|
8
|
+
"format:check": "bunx prettier --check .",
|
|
9
|
+
"check": "bun run validate && bun run format:check"
|
|
10
|
+
}
|
|
11
|
+
}
|