@sjawhar/opencode-legion-envoy 8.30.0 → 8.30.2

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 (34) hide show
  1. package/package.json +1 -1
  2. package/skills/envoy/SKILL.md +47 -286
  3. package/skills/envoy/references/check-settlement.md +62 -0
  4. package/skills/envoy/references/deliveries.md +62 -0
  5. package/skills/envoy/references/legion.md +12 -0
  6. package/skills/envoy/references/roles.md +10 -0
  7. package/skills/envoy/references/sources.md +41 -0
  8. package/skills/legion-architect/SKILL.md +41 -419
  9. package/skills/legion-architect/references/acceptance.md +153 -0
  10. package/skills/legion-architect/references/decomposition.md +77 -0
  11. package/skills/legion-architect/references/design-gate.md +148 -0
  12. package/skills/legion-architect/references/wake-routing.md +11 -6
  13. package/skills/legion-controller/SKILL.md +96 -469
  14. package/skills/legion-controller/references/admission.md +7 -6
  15. package/skills/legion-controller/references/backlog-stewardship.md +32 -27
  16. package/skills/legion-controller/references/daily-report.md +72 -0
  17. package/skills/legion-controller/references/escalation.md +37 -0
  18. package/skills/legion-controller/references/finding-asks.md +32 -14
  19. package/skills/legion-controller/references/session.md +98 -0
  20. package/skills/legion-controller/references/slack-mentions.md +10 -9
  21. package/skills/legion-controller/references/triage.md +81 -0
  22. package/skills/legion-controller/references/wakes.md +90 -0
  23. package/skills/legion-oracle/SKILL.md +26 -57
  24. package/skills/legion-retro/SKILL.md +116 -240
  25. package/skills/legion-retro/references/learnings.md +58 -0
  26. package/skills/legion-retro/references/pr-body-content.md +78 -0
  27. package/skills/legion-worker/SKILL.md +40 -462
  28. package/skills/legion-worker/references/conflicts-and-rewrites.md +2 -2
  29. package/skills/legion-worker/references/default-branch-check.md +16 -0
  30. package/skills/legion-worker/references/findings.md +2 -2
  31. package/skills/legion-worker/references/pr-body.md +1 -1
  32. package/skills/legion-worker/references/review-threads.md +1 -1
  33. package/skills/thermonuclear-code-quality/SKILL.md +34 -82
  34. package/skills/thermonuclear-deep-review/SKILL.md +34 -33
@@ -6,98 +6,50 @@ disable-model-invocation: true
6
6
 
7
7
  # Thermonuclear Code Quality
8
8
 
9
- A strict maintainability audit of the current branch's changes.
9
+ If this skill disagrees with the code, a command's output or its `--help`, follow those and say which line of this skill is wrong.
10
10
 
11
- ## Baseline
11
+ This is a maintainability review of one diff: the current branch's changes, or the range you are given. Every remedy keeps behavior the same and removes code or concepts, or moves code where a reader finds it without reading the rest of the file, because a behavior change is work for `skill://thermonuclear-deep-review`, not a cleanup. The table's last two rows change ordering or failure behavior: say so in the finding.
12
12
 
13
- - Rethink how to structure and implement the changes so code quality improves and behavior does not change. The aim is code that is smaller, more direct and easier to maintain.
14
- - Improve abstractions and modularity. Reduce spaghetti code. Make the code succinct and legible.
15
- - Restructure when there is a clear path to a simpler implementation. Do not stop at local cleanup when a coherent simplification is available.
16
- - Be thorough and rigorous. Verify each claim before you report it.
13
+ ## Report
17
14
 
18
- ## Look for the code-judo move first
15
+ The first line is the verdict, with the short sha of the head you reviewed (`git rev-parse --short=8 HEAD`, or the sha your brief names when you have no shell):
19
16
 
20
- - For each meaningful change, ask: can a reorganization that uses the existing architecture better make whole branches, helpers, modes, conditionals or layers disappear?
21
- - Push hard to delete complexity, not to rearrange it. Prefer the solution that looks inevitable in hindsight.
22
- - A refactor that moves code but leaves the reader the same number of concepts to hold is not a simplification. Ask whether the model itself can be simpler.
23
- - Do not accept a cleaner version of the same messy idea when a much simpler idea is plausible. Do not give "maybe rename this" feedback when the real issue is structural.
24
- - "It works" and "tests pass" are not the bar. If the structure can become meaningfully cleaner with the same behavior, push for the cleaner version.
17
+ - `Verdict: APPROVE at <sha>` when no finding stands.
18
+ - `Verdict: CHANGES at <sha>` when one does.
25
19
 
26
- ## What to flag, and the remedy to propose
20
+ Put nothing before it: a PR gate reads only the first line of a posted report.
27
21
 
28
- Flag these aggressively, and any change that makes the surrounding code harder to reason about, even when the code works:
22
+ Then one entry per finding: `path:line`, the smell, the cost it adds, and the remedy, so the author can act on it without asking. Report few findings, each one you are sure of: a long list hides the ones that block. Order them so the costliest is read first: step 2's structural regressions and missed code-judo moves, then rows 2-3, 7-8, 1, 9-10, then the rest. Write each as a plain request: `this adds another special-case branch to an already busy flow. Move it into its own function.`
29
23
 
30
- | Smell | Remedy |
31
- |---|---|
32
- | The PR pushes a file from under 1000 lines to over 1000 | Ask whether to decompose first into helpers, subcomponents, modules or local abstractions. Accept only for a compelling structural reason, with the file still well organized. |
33
- | Ad-hoc conditionals, special cases, one-off booleans, nullable modes or flags in unrelated or busy flows. Narrow edge cases in the middle of a busy function. "Temporary" branches. | A design problem, not a nit. Reframe the state model so the conditionals disappear, not only move to one place. Make the special case part of a simpler default flow. Else move it behind its own abstraction, helper, state machine, policy object or module. |
34
- | Repeated conditionals or condition chains | A typed model or an explicit dispatcher. |
35
- | Copy-pasted logic or duplicate branches | Extract a helper or pure function. Collapse into one flow. |
36
- | Hacky, brittle or "magic" behavior. Generic mechanisms that hide simple data-shape assumptions. | Direct, boring code. |
37
- | Thin wrappers, identity abstractions, pass-through helpers | Delete the layer. |
38
- | Unnecessary optionality, `unknown`, `any`, casts, loose ad-hoc objects. A silent fallback over an unclear invariant. | Explicit typed models or shared contracts, so the control flow gets simpler. |
39
- | Feature logic in shared paths. Implementation details leaking through APIs. Logic in the wrong file, layer or package. | Move it to the layer that owns the concept, so the feature extends an existing abstraction. |
40
- | A bespoke helper where a canonical utility exists | Reuse the canonical helper. |
41
- | A module that became more coupled, stateful or hard to scan. Orchestration mixed with business logic. | Split into focused modules. Separate orchestration from business logic. |
42
- | Independent work run in sequence for no good reason | Run it in parallel when that also simplifies the orchestration. |
43
- | Related updates that can leave state half-applied | A more atomic flow. |
24
+ ## Steps
44
25
 
45
- Flag orchestration only when the cleaner structure is obvious. Do not over-index on micro-optimizations.
26
+ 1. Read the diff and each changed file around its hunks. Flag lines the diff adds or changes, and existing code it makes harder to follow, such as a function it lengthens or adds a branch or parameter to. A finding on code the diff leaves alone blocks the PR for work it did not cause.
27
+ 2. Look for the code-judo move first: a restructure onto the existing architecture that deletes whole branches, helpers, modes, conditionals or layers. A structural fix often removes the line-level findings with it.
28
+ 3. For a refactor, count the concepts (the types, functions, flags and modes) a reader must know before and after. A move that keeps the count is not a simplification: say so, rather than accept a cleaner version of the same idea. When the problem is structural, do not suggest a rename, which hides the finding that matters.
29
+ 4. Check every hunk against the table below, because each row is a smell this review blocks on. For file size, compare `git show <base>:<path> | wc -l` with `wc -l <path>`; `<base>` is the range start your brief names, else `git merge-base HEAD origin/<default branch>`.
30
+ 5. Before you report a finding, quote its line at the reviewed head. For a boundary, type or duplicate-helper claim, also read the callers (`grep` the symbol) and the existing helper you name. A finding built on a misread costs the author a round.
31
+ 6. Report only a cost you can name (the table's Cost column). A preference or a micro-optimization with no such cost is not a finding. When a structural finding exists, leave out naming and style nits, because they bury it.
32
+ 7. Ask for a new abstraction (a type, module or policy object) only when the code shows two real callers or two ways it will change. With one, the abstraction is the thin wrapper row 6 flags.
46
33
 
47
- ## Tone
34
+ ## Smells and remedies
48
35
 
49
- - Be direct, serious and demanding. Do not be rude.
50
- - Do not soften a major maintainability issue into a mild suggestion. If the code makes the codebase messier, or missed a substantial simplification, say so.
51
- - Examples:
52
- - `this pushes the file past 1k lines. can we decompose this first?`
53
- - `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
54
- - `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
55
- - `why does this need a cast / optional here? can we make the boundary more explicit instead?`
56
- - `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
57
-
58
- ## Output
59
-
60
- Order findings:
61
-
62
- 1. Structural regressions
63
- 2. Missed dramatic simplifications (code judo)
64
- 3. Spaghetti and branching growth
65
- 4. Boundary, abstraction and type-contract problems
66
- 5. File size and decomposition
67
- 6. Modularity and abstraction
68
- 7. Legibility and maintainability
69
-
70
- Give a small number of high-conviction comments. When larger structural issues exist, leave out low-value nits.
36
+ | Smell | Cost | Remedy |
37
+ |---|---|---|
38
+ | The PR pushes a file from under 1000 lines to over 1000 | more to scan for every change | Decompose it first into helpers, modules or local abstractions. Accept the growth only when the PR names the caller or constraint that keeps the code in that file. |
39
+ | Ad-hoc conditionals, special cases, one-off booleans, nullable modes or flags in unrelated or busy flows. A branch for one input value in the middle of a busy function. A branch whose name or comment says it is temporary. | each later change reads every branch | Reframe the state model so the conditionals disappear, not only move to one place. Make the special case part of a simpler default flow. Else move it into its own function, or behind an abstraction step 7 allows. |
40
+ | Repeated conditionals or condition chains | each new case edits every chain | A typed model or an explicit dispatcher. |
41
+ | Copy-pasted logic or duplicate branches | a fix lands in one copy | Extract a helper or pure function. Collapse into one flow. |
42
+ | Hacky, brittle or "magic" behavior, such as reading a value by its string form or position. Generic mechanisms that hide simple data-shape assumptions. | the assumption breaks with no error | Direct code that states the assumption: a typed field, a named constant, an explicit check. |
43
+ | Thin wrappers, identity abstractions, pass-through helpers | one more layer to cross | Delete the layer. |
44
+ | Unnecessary optionality, `unknown`, `any`, casts, loose ad-hoc objects. A silent fallback over an unclear invariant. | the type hides what the value is | Explicit typed models or shared contracts, so the control flow gets simpler. |
45
+ | Feature logic in shared paths. Implementation details leaking through APIs. Logic in the wrong file, layer or package. | every caller of the shared path pays | Move it to the package whose existing code already reads or writes that data (`grep` its type). |
46
+ | A bespoke helper where the repository already has one that does the same | two helpers drift apart | Reuse the existing helper; name it as `path:line`. |
47
+ | A module that became more coupled (a new import of another package), stateful (new module-level state) or hard to scan. Orchestration mixed with business logic. | a change to one concern touches the others | Split into focused modules. Separate orchestration from business logic. |
48
+ | Independent work run in sequence | an order nothing needs | Run it in parallel, only when the parallel code is also simpler. |
49
+ | Related updates that can leave state half-applied | a failure leaves state no code expects | A more atomic flow. |
71
50
 
72
51
  ## Approval bar
73
52
 
74
- Correct behavior alone does not earn approval. Approve only when the diff has none of these:
75
-
76
- - a clear structural regression
77
- - a missed, visible path to a dramatically simpler implementation
78
- - unjustified file-size growth
79
- - spaghetti growth from special-case branching
80
- - a hacky or magic abstraction
81
- - wrapper, cast or optionality churn that hides the design
82
- - a clear boundary leak, or avoidable duplication of a canonical helper
83
- - a missed obvious decomposition that would materially help maintainability
84
-
85
- These block unless the author justifies them with evidence:
86
-
87
- - incidental complexity kept when a plausible code-judo move would delete it
88
- - a file pushed from under 1000 lines to over 1000
89
- - ad-hoc branching that tangles an existing flow
90
- - a local problem solved by scattering feature conditionals across shared code
91
- - an unnecessary abstraction, wrapper or cast-heavy contract
92
- - a duplicated helper, or logic in the wrong layer, when a clear canonical home exists
93
-
94
- When the bar is not met, leave explicit, actionable feedback and push for a cleaner decomposition.
95
-
96
- ## Verdict
97
-
98
- Make the first line of the report the verdict, in exactly this form, with the short sha of the head commit you reviewed (`git rev-parse --short=8 HEAD`):
99
-
100
- - `Verdict: APPROVE at <sha>` when the diff meets the approval bar.
101
- - `Verdict: CHANGES at <sha>` when it does not.
102
-
103
- A PR gate can read the verdict from the first line of a posted report, and it reads only that line. Put nothing before the verdict.
53
+ - A structural regression, a hacky or magic abstraction, a boundary leak, or a missed obvious decomposition blocks whatever the PR says, because no evidence makes the code easier to change.
54
+ - Every other finding blocks, and the verdict is CHANGES, unless the PR gives evidence that the simpler form fails: a caller it breaks, a measured cost, or a constraint outside the diff that the PR names with `path:line` or a link. "It works" and "tests pass" are no such evidence, because this review judges structure, not behavior.
55
+ - State a blocking finding as blocking, directly and without rudeness. A "maybe" or "consider" finding reads as optional and gets skipped.
@@ -6,33 +6,44 @@ disable-model-invocation: true
6
6
 
7
7
  # Thermonuclear Deep Review
8
8
 
9
- As a security reviewer, audit the changes of the checked-out branch for bugs, regressions and security vulnerabilities. Be rigorous. Report only what the evidence supports.
9
+ If this skill disagrees with the code, a command's output or its `--help`, follow those and say which line of this skill is wrong.
10
+
11
+ ## Verdict
12
+
13
+ The first line of the report is the verdict, in exactly this form, because a PR gate reads only that line:
14
+
15
+ - `Verdict: CHANGES at <sha>` when the report has a Medium or High finding.
16
+ - `Verdict: APPROVE at <sha>` when it has none. Minor findings do not block.
17
+
18
+ Priority: trace each finding end to end first. Minor changes no behavior, hides no error and breaks no gate; any other finding is Medium, or High when the report holds its trace, because developers who get false High findings stop listening.
19
+
20
+ `<sha>`: `git rev-parse --short=8 HEAD` at the head you reviewed, or the sha your brief names when you have no shell.
10
21
 
11
22
  ## Scope
12
23
 
13
- Report only issues in code that the PR adds or modifies. Exception: unchanged code that consumes behavior the diff changes (check 2). A broken consumer is a defect of this diff, but the diff never shows it.
24
+ Audit the checked-out branch. Report issues in code its diff adds or modifies, in the unchanged consumers check 2 finds, and in the PR body's claims (check 6), because the author fixes only this diff and the diff never shows them.
14
25
 
15
26
  ## Checks
16
27
 
17
- 1. **Breakage.** Trace each change through its callers and contracts, across packages and modules.
18
- 2. **Consumers.** For each behavior the diff changes, name its consumers and show that each one still works. Behaviors: log level, status code, exception type, metric or field name, payload shape, identity or uniqueness key, timing, retry, default. Tracing callers does not find consumers, and many are outside the diff, the package or the repository:
28
+ 1. **Breakage.** Trace each change through its callers and contracts, across packages and modules, because breaks show outside the changed lines.
29
+ 2. **Consumers.** For each behavior the diff changes, name its consumers and show that each one still works. Behaviors: log level, status code, exception type, metric or field name, payload shape, identity or uniqueness key, timing, retry, default. Tracing callers misses consumers, many outside the diff, the package or the repository:
19
30
  - alert and monitor predicates (a monitor on `status:error` stops when a line goes down to WARNING)
20
31
  - log-level contracts, structured-log field names, log-derived metric filters
21
32
  - status codes and error-type strings in request logs, webhooks and audit records
22
- - identity or uniqueness keys that a persistence layer arbitrates on (a new id for an existing row collides with a constraint)
33
+ - identity or uniqueness keys that a persistence layer arbitrates on
23
34
  - dashboards, SLOs, saved queries, downstream parsers
24
35
 
25
- If you cannot find a consumer, say so. Never assume that none exists. A change that removes its own alarm is the highest severity here, because it also removes the signal that would catch it.
26
- 3. **Developer experience.** Find changes to how developers run or build the code locally. Examples: where or how the code reads secrets, new or renamed environment variables, remapped ports or networking. A new script that must run for a feature to keep working is also a change. Not a break: a new alternative way to run or build, or a new package-manager dependency. Exception: a dependency that needs a step outside the usual workflow, such as a manual install from a website or app store, is a break.
27
- 4. **Feature leaks.** Trace each feature flag or internal-only check and its callers. Do not let a gated feature leak.
28
- 5. **Intended breakage.** An intended, well-constrained high-risk effect is not a defect. Report it when its scope or consequences are unclear, or when it removes a safeguard or feature gate.
29
- 6. **PR body claims.** Attack each safety or correctness claim in the PR body, not only the diff. Only a reviewer told to attack a claim finds a wrong one. Attack these first:
36
+ If you cannot find a consumer, say so, because an assumed-away consumer breaks silently. A change that removes its own alarm is High, because it also removes the signal that would catch it.
37
+ 3. **Developer experience.** Find changes to how developers run or build the code locally, because no test catches them. Examples: where or how the code reads secrets, new or renamed environment variables, remapped ports or networking, a new script that must run for a feature to keep working. Not a break: a new alternative way to run or build, or a new package-manager dependency, unless it needs a step the README or AGENTS.md does not list, such as a manual install from a website or app store.
38
+ 4. **Feature leaks.** Trace each feature flag or internal-only check and its callers, because a leak ships a feature to users a gate excludes.
39
+ 5. **Intended breakage.** A high-risk effect the PR body names and bounds (who it affects, how to undo it) is not a defect, because the author chose it. Report one it does not, or one that removes a safeguard or feature gate.
40
+ 6. **PR body claims.** Attack each safety or correctness claim in the PR body, because the diff does not show whether a claim in prose is true. Attack these first:
30
41
  - Order, not coverage: after a pipeline sanitizes, can any later pass create or recreate what the sanitizer neutralized?
31
- - A severity that relies on a third party's formatting is a dependency, not a mitigation. Rate it as that bet, and fix it, do not only disclose it.
42
+ - An input called safe because another program escapes it depends on that program: rate the finding as if it did not.
32
43
 
33
44
  ## Security Guidelines
34
45
 
35
- For each row whose surface the diff touches, answer with a file:line citation.
46
+ For each row whose surface the diff touches, answer with a file:line citation, because an answer without one cannot be checked.
36
47
 
37
48
  | Tag | If the diff touches… | Answer, with file:line |
38
49
  | --- | --- | --- |
@@ -42,33 +53,23 @@ For each row whose surface the diff touches, answer with a file:line citation.
42
53
  | `prompt` | a prompt that embeds untrusted text into an agent's instructions | what delimits the untrusted region, and what the agent may do if it obeys that text (OWASP LLM01 prompt injection, LLM06 excessive agency) |
43
54
  | `supply-chain` | a dependency, lockfile, base image, or GitHub Action | the version, the pin (a digest or a SHA checked against its tag), and the permissions the workflow runs with |
44
55
  | `sandbox` | a sandbox or pod manifest, a capability, or a network policy | which isolation property changed, and against whom |
45
- | `agent-def` | an agent definition, skill, role prompt, `.omp/` config, or `AGENTS.md` | whether this diff can steer its own reviewers, and why this edit is trustworthy anyway |
46
- | `transport` | TLS or certificate verification, a signature, an HMAC, a randomness source, or a read or write that untrusted input sizes with no bound | what changed, the check or bound it relies on, and the ASVS V11 or V12 identifier it maps to |
56
+ | `agent-def` | an agent definition, skill, role prompt, `.omp/` config, or `AGENTS.md` | whether this diff can steer its own reviewers, and, if so, what a reviewer must check by hand |
57
+ | `transport` | TLS or certificate verification, a signature, an HMAC, a randomness source, or a read or write that untrusted input sizes with no bound | what changed, the check or bound it relies on, and the ASVS identifier it maps to |
47
58
 
48
- - Cite an OWASP ASVS v5.0.0 identifier where one applies (`v5.0.0-1.2.5` style).
49
- - A security finding with no stated exploit path is not a finding. Call it hardening and rank it Minor. A security finding that states an exploit path is always its own finding at its real priority. Never put it in the hardening items.
50
- - Report at most two hardening items, ranked. Put the rest in one hardening paragraph.
59
+ - Cite an OWASP ASVS v5.0.0 identifier where one applies (`v5.0.0-1.2.5` style), so the author can find it.
60
+ - A security finding with no stated exploit path is hardening, ranked Minor. One that states an exploit path is its own finding at its real priority, so no exploit is filed as optional.
61
+ - Report at most two hardening items, ranked, and put the rest in one paragraph, so they do not bury findings.
51
62
  - Start each security finding with its row's tag, `Security[<tag>]:`, so readers can count findings by row.
52
- - End the report with one `Security:` line: each touched row's tag and its answer with file:line, or `Security: no sensitive surface in this diff.` when the diff touches none.
63
+ - End the report with one `Security:` line, because the Legion reviewer copies it: each touched row's tag and its answer with file:line, or `Security: no sensitive surface in this diff.` when the diff touches none.
53
64
 
54
65
  ## Findings
55
66
 
56
- - Never misreport priority. Developers who get false High findings stop listening. Trace each issue end to end.
57
- - Never report a finding with research still open. If you can read the code that settles it, read it. Not: "the client has issue X, but if the backend handles it, this is ok."
58
-
59
- ## Verdict
60
-
61
- Make the first line of the report the verdict, in exactly this form, with the short sha of the head commit you reviewed (`git rev-parse --short=8 HEAD`):
62
-
63
- - `Verdict: CHANGES at <sha>` when the report has a finding that the author must fix before merge.
64
- - `Verdict: APPROVE at <sha>` when it has none. Hardening items alone do not block.
65
-
66
- A PR gate can read the verdict from the first line of a posted report, and it reads only that line. Put nothing before the verdict.
67
+ - Never report a finding whose open question you can settle by reading code, because the author cannot act on a guess. When you cannot settle it, say what you searched and where.
67
68
 
68
69
  ## PR discussion
69
70
 
70
- Only after your independent audit, and only when you have Medium-to-High findings and the branch has a PR:
71
+ Only after your own audit, so others' findings do not steer it, and only with a Medium or High finding on a branch that has a PR:
71
72
 
72
- 1. Read the PR/MR discussion with `gh` or `glab` for comments from BugBot or others.
73
- 2. Check their findings. Include the valid ones you missed, and add what is useful from the ones you share.
74
- 3. Mark each finding that came from that discussion.
73
+ 1. Read the PR/MR's comments and review comments, bots' included, with `gh` or `glab`.
74
+ 2. Check their findings in the code: a comment is not evidence. Include the valid ones you missed; for one you share, add their evidence if yours lacks it.
75
+ 3. Mark each finding that came from that discussion, so readers can tell it from yours.