@sjawhar/claude-envoy 0.0.0 → 1.1.0

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 (113) hide show
  1. package/.claude-plugin/plugin.json +6 -0
  2. package/.mcp.json +11 -0
  3. package/.omp-plugin/plugin.json +6 -0
  4. package/AGENTS.md +343 -0
  5. package/README.md +639 -0
  6. package/bin/dispatch +6 -0
  7. package/bin/envoy-channel.ts +9 -0
  8. package/bin/envoy-send.ts +33 -0
  9. package/dist/THIRD_PARTY_NOTICES +816 -0
  10. package/dist/dispatch.js +27707 -0
  11. package/dist/envoy-channel.js +57695 -0
  12. package/dist/session-hook.js +26328 -0
  13. package/dist/session-title-hook.js +116 -0
  14. package/hooks/hooks.json +60 -0
  15. package/hooks/session-hook.ts +512 -0
  16. package/hooks/session-title-hook.ts +46 -0
  17. package/legion/.claude-plugin/plugin.json +4 -0
  18. package/legion/agents/deep-worker.md +68 -0
  19. package/legion/agents/oracle.md +35 -0
  20. package/legion/agents/plan-gap-analyst.md +65 -0
  21. package/legion/agents/plan-reviewer.md +104 -0
  22. package/legion/agents/thermonuclear-code-quality.md +30 -0
  23. package/legion/agents/thermonuclear-deep-review.md +30 -0
  24. package/legion/hooks/hooks.json +89 -0
  25. package/legion/skills/ce-simplify-code/LICENSE +21 -0
  26. package/legion/skills/ce-simplify-code/SKILL.md +66 -0
  27. package/legion/skills/ce-simplify-code/references/personas/code-quality-reviewer.md +17 -0
  28. package/legion/skills/ce-simplify-code/references/personas/code-reuse-reviewer.md +7 -0
  29. package/legion/skills/ce-simplify-code/references/personas/efficiency-reviewer.md +11 -0
  30. package/legion/skills/leading-a-work-stream/SKILL.md +96 -0
  31. package/legion/skills/leading-a-work-stream/references/daily-plan.md +8 -0
  32. package/legion/skills/leading-a-work-stream/references/decision-rights.md +6 -0
  33. package/legion/skills/leading-a-work-stream/references/direction-and-coaching.md +13 -0
  34. package/legion/skills/leading-a-work-stream/references/dispatch-upkeep.md +8 -0
  35. package/legion/skills/leading-a-work-stream/references/sources.md +9 -0
  36. package/legion/skills/leading-a-work-stream/references/speed-tick.md +44 -0
  37. package/legion/skills/leading-a-work-stream/references/user-quotes.md +7 -0
  38. package/legion/skills/legion-architect/SKILL.md +86 -0
  39. package/legion/skills/legion-architect/references/acceptance.md +208 -0
  40. package/legion/skills/legion-architect/references/decomposition.md +129 -0
  41. package/legion/skills/legion-architect/references/design-gate.md +206 -0
  42. package/legion/skills/legion-architect/references/merge-notices.md +91 -0
  43. package/legion/skills/legion-architect/references/wake-routing.md +41 -0
  44. package/legion/skills/legion-controller/SKILL.md +151 -0
  45. package/legion/skills/legion-controller/references/admission.md +22 -0
  46. package/legion/skills/legion-controller/references/backlog-stewardship.md +101 -0
  47. package/legion/skills/legion-controller/references/daily-report.md +75 -0
  48. package/legion/skills/legion-controller/references/escalation.md +82 -0
  49. package/legion/skills/legion-controller/references/finding-asks.md +181 -0
  50. package/legion/skills/legion-controller/references/parked-decisions.md +198 -0
  51. package/legion/skills/legion-controller/references/session.md +100 -0
  52. package/legion/skills/legion-controller/references/slack-mentions.md +154 -0
  53. package/legion/skills/legion-controller/references/triage.md +96 -0
  54. package/legion/skills/legion-controller/references/wakes.md +132 -0
  55. package/legion/skills/legion-oracle/SKILL.md +48 -0
  56. package/legion/skills/legion-retro/SKILL.md +112 -0
  57. package/legion/skills/legion-retro/references/learnings.md +60 -0
  58. package/legion/skills/legion-retro/references/pr-body-content.md +56 -0
  59. package/legion/skills/legion-worker/SKILL.md +69 -0
  60. package/legion/skills/legion-worker/references/cleanup-deletion.md +22 -0
  61. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +164 -0
  62. package/legion/skills/legion-worker/references/default-branch-check.md +53 -0
  63. package/legion/skills/legion-worker/references/findings.md +199 -0
  64. package/legion/skills/legion-worker/references/merge-gate.md +353 -0
  65. package/legion/skills/legion-worker/references/pr-body.md +218 -0
  66. package/legion/skills/legion-worker/references/review-threads.md +77 -0
  67. package/legion/skills/legion-worker/references/systematic-rename.md +19 -0
  68. package/legion/skills/legion-worker/references/tools.md +708 -0
  69. package/legion/skills/thermonuclear-code-quality/LICENSE +21 -0
  70. package/legion/skills/thermonuclear-code-quality/SKILL.md +60 -0
  71. package/legion/skills/thermonuclear-deep-review/LICENSE +21 -0
  72. package/legion/skills/thermonuclear-deep-review/SKILL.md +80 -0
  73. package/package.json +49 -1
  74. package/scripts/build-inputs.txt +84 -0
  75. package/scripts/build.ts +415 -0
  76. package/scripts/check-packed-skills.sh +50 -0
  77. package/scripts/pack-skills.sh +146 -0
  78. package/scripts/smoke-channel.sh +178 -0
  79. package/scripts/smoke-clear-rebind.sh +164 -0
  80. package/scripts/smoke-session-title.sh +245 -0
  81. package/scripts/verify-build.sh +88 -0
  82. package/skills/agent-secrets/SKILL.md +180 -0
  83. package/skills/asd-ste100/LICENSE +21 -0
  84. package/skills/asd-ste100/SKILL.md +140 -0
  85. package/skills/asd-ste100/examples/before-after.md +92 -0
  86. package/skills/asd-ste100/references/writing-rules.md +59 -0
  87. package/skills/dispatch/SKILL.md +89 -0
  88. package/skills/dispatch-first/SKILL.md +46 -0
  89. package/skills/dispatch-writing-specs/SKILL.md +80 -0
  90. package/skills/envoy/SKILL.md +82 -0
  91. package/skills/envoy/references/check-settlement.md +62 -0
  92. package/skills/envoy/references/deliveries.md +67 -0
  93. package/skills/envoy/references/legion.md +14 -0
  94. package/skills/envoy/references/roles.md +12 -0
  95. package/skills/envoy/references/sources.md +41 -0
  96. package/skills/outside-message/SKILL.md +111 -0
  97. package/skills/plain-words/SKILL.md +88 -0
  98. package/src/channel-forwarder.ts +262 -0
  99. package/src/claude-channel.ts +705 -0
  100. package/src/claude-session.ts +38 -0
  101. package/src/envoy-channel-server.ts +2115 -0
  102. package/src/envoy-client.ts +26 -0
  103. package/src/envoy-off.ts +62 -0
  104. package/src/legion-claim.ts +211 -0
  105. package/src/legion-inbox.ts +110 -0
  106. package/src/legion-phase-hook.ts +554 -0
  107. package/src/legion-tool.ts +69 -0
  108. package/src/replay-state.ts +97 -0
  109. package/src/send-arguments.ts +13 -0
  110. package/src/session-identity.ts +165 -0
  111. package/src/session-state.ts +142 -0
  112. package/src/session-title.ts +251 -0
  113. package/src/subscription-topics.ts +16 -0
@@ -0,0 +1,77 @@
1
+ # Review threads
2
+
3
+ Part of `skill://legion-worker`. Read it when you reply on or resolve a review thread, list a pull
4
+ request's threads, or adjudicate a bot's finding: the implementer after every push that answers a
5
+ review, and the reviewer on every re-review. Every path it cites is in cybermonklabs/legion.
6
+
7
+ Three facts govern every thread, whoever opened it.
8
+
9
+ - **Reply on each thread you answer, one disposition reply per thread.** Every open review thread
10
+ gets its own reply naming the fixing commit or the reason it isn't a defect: the implementer's
11
+ `Fixed in <commit>: <one line>` or `Declined: <reason>`; the reviewer's reasons in its own words —
12
+ the commit that fixed it, why it is not a defect, or what still stands. No word in a reply
13
+ resolves anything, and nothing reads a reply for a magic form: a thread is resolved only by the
14
+ resolution below, after its reply.
15
+ - **Resolve each thread you have answered, one thread per call, never in bulk, never a thread you
16
+ have not read.** GitHub grants `resolveReviewThread` to the pull request's author, and the
17
+ implementer opens every Legion pull request (`docs/site/src/content/docs/legion/running-legion.md`,
18
+ "The GitHub Apps"), so the implementer resolves every thread, its own and the ones the
19
+ reviewer accepted:
20
+ - The **implementer**, after every push that answers a review and before its `handoff_complete`,
21
+ resolves each thread it answered with its own `gh`, one thread per call:
22
+
23
+ ```bash
24
+ gh api graphql -f query='mutation($id:ID!){resolveReviewThread(input:{threadId:$id}){thread{isResolved}}}' -F id=<thread node id>
25
+ ```
26
+
27
+ A thread a bot opened (a CI bot's, or an App-routed person's) it answers the same way; the
28
+ reviewer adjudicates the finding. The bot threads the reviewer accepted, which the reviewer
29
+ names to the implementer by node id (below), the implementer resolves with the same call, one
30
+ per thread, as soon as the message reaches it or as part of answering that review, and records
31
+ in the PR body's `Threads` section too; never one the reviewer did not name. When GitHub refuses
32
+ a resolution, report the thread and GitHub's message to the architect with `envoy_publish`,
33
+ which opens a `dispatch ask` for a human to resolve it by hand; never skip it silently.
34
+ - The **reviewer** cannot resolve a thread as its own App: GitHub refuses the review App
35
+ `resolveReviewThread` on the implementer's pull request, so it replies, and names the threads
36
+ it accepted to the implementer, who resolves them. List the pull request's threads:
37
+
38
+ ```bash
39
+ gh api graphql --paginate -f query='query($o:String!,$r:String!,$n:Int!,$endCursor:String){repository(owner:$o,name:$r){pullRequest(number:$n){reviewThreads(first:100,after:$endCursor){pageInfo{hasNextPage endCursor} nodes{id isResolved comments(last:1){nodes{author{login} body}}}}}}}' -F o=<owner> -F r=<repo> -F n=<number>
40
+ ```
41
+
42
+ `--paginate` follows the thread pages, which it prints as one JSON object per page, so add
43
+ `--slurp` when you want a single document; `comments(last:1)` needs no paging of its own.
44
+
45
+ Reply on each thread you answer, then tell the implementer the node ids of exactly the threads
46
+ you accepted — a bot's findings you adjudicated — never one you have not read: an
47
+ `envoy_publish` to the implementer's role topic (it is live on the issue and answers while you
48
+ wait; its topic is yours from the `Legion addressing` line with `-implementer` as the last part), or your review body, which
49
+ it reads at its next round. The implementer resolves exactly those with its own `gh`. GitHub
50
+ cannot tell a CI bot from a person whose `gh` is routed to an App, so such a thread may be a
51
+ person's finding: accept it only when the finding itself is settled (a genuine Minor is settled
52
+ by being judged Minor), since the resolution says you judged it.
53
+ - **A reviewer who disagrees with a resolution replies and unresolves it.** Resolution is a
54
+ judgment, not a ledger entry: a thread the implementer resolved whose finding still stands gets
55
+ the reviewer's reply saying what stands and is unresolved, and a finding the reviewer cannot
56
+ accept becomes its own, with a `REQUEST_CHANGES` naming it.
57
+
58
+ ## The PR body's `Threads` section
59
+
60
+ The implementer records each thread it answered in the PR body's `Threads` section
61
+ (`skill://legion-worker/references/pr-body.md`), stamped with the head it just pushed: the thread's
62
+ id, its disposition (`fixed in <commit-sha> — <one line>` or `not a defect — <reason>`), and the
63
+ head that answered it. The reviewer verifies thread state in `gh api graphql`, never from that
64
+ section: it is the implementer's record, and GitHub is the fact.
65
+
66
+ ## The reviewer, on a re-review
67
+
68
+ When you re-review after a corrective push, answer every thread you opened, and every thread a bot
69
+ opened that is none of Legion's role Apps, with one reply in your own words. A bot's finding you
70
+ cannot accept becomes your own: say what stands and request changes. Approve once each of those
71
+ threads carries your answer and no finding stands, read in `gh api graphql` — quote those answers
72
+ in the approval. Your approval never waits on a resolution: resolution is the pull request author's
73
+ App's. A review bot that is red while a thread it opened still stands is CI like any other, and
74
+ you re-run nothing: when the base branch requires its check, that red sends the work back to the
75
+ implementer, who answers or fixes each of the bot's threads, resolves them with its own `gh` (the
76
+ ones you named to it, above, and its own), and pushes, and the bot runs again on that push. The
77
+ merger resolves nothing: READY requires no thread state beyond what your approval already judged.
@@ -0,0 +1,19 @@
1
+ # Strategy: Systematic Rename
2
+
3
+ When a repo, package, or URL is renamed across a codebase.
4
+
5
+ ## Checklist
6
+
7
+ 1. **Scope by file type** — grep all text-bearing extensions, not just the obvious ones:
8
+ - Source code (`.ts`, `.js`, `.py`, `.sh`) — functional, must update
9
+ - CI/CD configs (`.yml`, `.yaml`) — functional, must update
10
+ - Documentation (`.md`) — correctness, should update
11
+ - Config files (`.json`, `.toml`) — check but may be immutable
12
+
13
+ 2. **Classify matches as mutable vs immutable** — historical records (transcripts, test snapshots, progress logs) must NOT be modified. Changing them falsifies history.
14
+
15
+ 3. **Check comments for semantic context** — a comment mentioning the old name may still be correct in intent. Update the name but preserve the reasoning.
16
+
17
+ 4. **Verify with grep before AND after** — capture pre-edit state as a baseline for comparison.
18
+
19
+ 5. **Use `jj diff --git`** for verification — plain `jj diff` without color concatenates old/new text confusingly (e.g., `old-nameNEW-name` without color codes).