@hecer/yoke 1.9.0 → 1.11.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.
- package/.claude-plugin/plugin.json +13 -13
- package/.codex-plugin/plugin.json +7 -7
- package/CHANGELOG.md +398 -358
- package/README.md +915 -913
- package/TODOS.md +5 -5
- package/agents/docs.toml +6 -6
- package/agents/implementer.toml +6 -6
- package/agents/reviewer.toml +6 -6
- package/agents/security.toml +6 -6
- package/bench/README.md +86 -86
- package/bench/RESULTS.md +35 -35
- package/bench/output-compaction.mjs +65 -65
- package/bench/result-schema.mjs +12 -12
- package/bench/results/claude-2026-07-27T18-03-26.json +50 -50
- package/bench/results/codex-unavailable-1785175418318.json +15 -15
- package/bench/results/gemini-2026-07-27T18-03-44.json +46 -46
- package/bench/run-matrix.mjs +26 -26
- package/bench/run.mjs +106 -106
- package/canon/AGENTS.md +30 -30
- package/canon/context/DECISIONS.md +4 -4
- package/canon/context/GLOSSARY.md +11 -11
- package/canon/context/KNOWLEDGE.md +4 -4
- package/canon/context/PROJECT.md +15 -15
- package/canon/loop/loop-spec.md +65 -65
- package/canon/loop/prd.schema.md +46 -40
- package/canon/manifest.yaml +59 -59
- package/canon/policy/gates.md +7 -7
- package/canon/policy/roles.md +9 -9
- package/canon/skills/ATTRIBUTION.md +99 -99
- package/canon/skills/authoring-prd/SKILL.md +56 -56
- package/canon/skills/brainstorming/SKILL.md +164 -164
- package/canon/skills/codebase-design/DEEPENING.md +15 -15
- package/canon/skills/codebase-design/DESIGN-IT-TWICE.md +12 -12
- package/canon/skills/codebase-design/SKILL.md +39 -39
- package/canon/skills/dispatching-parallel-agents/SKILL.md +182 -182
- package/canon/skills/document-release/SKILL.md +302 -302
- package/canon/skills/domain-modeling/ADR-FORMAT.md +19 -19
- package/canon/skills/domain-modeling/CONTEXT-FORMAT.md +39 -39
- package/canon/skills/domain-modeling/SKILL.md +35 -35
- package/canon/skills/executing-plans/SKILL.md +70 -70
- package/canon/skills/finishing-a-development-branch/SKILL.md +200 -200
- package/canon/skills/health/SKILL.md +177 -177
- package/canon/skills/maintaining-context/SKILL.md +34 -34
- package/canon/skills/minimal-code/SKILL.md +21 -21
- package/canon/skills/no-ai-slop/SKILL.md +103 -103
- package/canon/skills/no-ai-slop/eval.md +43 -43
- package/canon/skills/plan-ceo-review/SKILL.md +541 -541
- package/canon/skills/plan-eng-review/SKILL.md +362 -362
- package/canon/skills/receiving-code-review/SKILL.md +213 -213
- package/canon/skills/requesting-code-review/SKILL.md +105 -105
- package/canon/skills/resolving-merge-conflicts/SKILL.md +18 -18
- package/canon/skills/retro/SKILL.md +397 -397
- package/canon/skills/review/SKILL.md +246 -246
- package/canon/skills/ship/SKILL.md +691 -691
- package/canon/skills/subagent-driven-development/SKILL.md +277 -277
- package/canon/skills/systematic-debugging/SKILL.md +296 -296
- package/canon/skills/tdd/SKILL.md +371 -371
- package/canon/skills/unslop-ui/SKILL.md +34 -34
- package/canon/skills/using-git-worktrees/SKILL.md +218 -218
- package/canon/skills/verification-before-completion/SKILL.md +139 -139
- package/canon/skills/visual-verification/SKILL.md +54 -54
- package/canon/skills/workflow/SKILL.md +22 -22
- package/canon/skills/writing-for-agents/SKILL-MECHANICS.md +27 -27
- package/canon/skills/writing-for-agents/SKILL.md +42 -42
- package/canon/skills/writing-plans/SKILL.md +152 -152
- package/canon/skills/writing-skills/SKILL.md +655 -655
- package/canon/skills/yoke-retrofit/SKILL.md +26 -26
- package/canon/skills/yoke-workflow/SKILL.md +20 -20
- package/canon/tools/codex-rtk-hook.mjs +35 -35
- package/canon/tools/gemini-rtk-hook.mjs +25 -25
- package/canon/tools/graphify.md +3 -3
- package/canon/tools/playwright-mcp.md +3 -3
- package/canon/tools/rtk.md +7 -7
- package/canon/tools/serena.md +6 -6
- package/dist/agents/contracts.js +1 -1
- package/dist/agents/host.js +4 -0
- package/dist/agents/process-incarnation.js +1 -1
- package/dist/agents/process.js +74 -6
- package/dist/agents/providers.js +13 -0
- package/dist/agents/supervision.js +153 -0
- package/dist/agents/telemetry.js +33 -0
- package/dist/agents/windows-launch.js +80 -0
- package/dist/canon/manifest.js +1 -1
- package/dist/change/inbox.js +21 -5
- package/dist/cli.js +19 -10
- package/dist/dashboard/discovery.js +73 -0
- package/dist/dashboard/page.js +122 -28
- package/dist/dashboard/panels.js +91 -15
- package/dist/goals/command.js +4 -2
- package/dist/loop/claims.js +1 -1
- package/dist/loop/decision.js +2 -2
- package/dist/loop/git.js +12 -4
- package/dist/loop/loop.js +8 -4
- package/dist/loop/parallel-adapters.js +2 -3
- package/dist/loop/parallel-command.js +5 -0
- package/dist/loop/prd.js +3 -1
- package/dist/loop/reporter.js +4 -1
- package/dist/loop/run-command.js +11 -2
- package/dist/loop/runner.js +22 -26
- package/dist/loop/watchdog.js +87 -11
- package/dist/loop/worker.js +5 -3
- package/dist/prd/assess.js +145 -0
- package/dist/prd/command.js +76 -38
- package/dist/quality/types.js +1 -1
- package/dist/retrofit/config.js +11 -0
- package/dist/retrofit/plan.js +2 -0
- package/dist/retrofit/planners/claude.js +14 -14
- package/dist/retrofit/planners/qwen.js +73 -0
- package/dist/retrofit/preserve.js +2 -2
- package/dist/retrofit/skill-actions.js +1 -0
- package/dist/review/command.js +1 -1
- package/dist/routing/assessment.js +1 -1
- package/dist/routing/capability.js +25 -13
- package/dist/routing/contracts.js +60 -0
- package/dist/routing/planning.js +12 -0
- package/dist/routing/router.js +51 -16
- package/dist/setup/command.js +11 -3
- package/docs/BATCH-PLANNING-VALIDATION.md +67 -0
- package/docs/CAPABILITY-ROUTING.md +78 -50
- package/docs/DASHBOARD-EVOLUTION.md +33 -0
- package/docs/MIGRATING-TO-1.0.md +33 -33
- package/docs/MIGRATING-TO-1.1.md +27 -27
- package/docs/MIGRATING-TO-1.4.md +70 -70
- package/docs/PRODUCT-DIRECTION-2026-09-05.md +218 -200
- package/docs/PUBLISHING.md +114 -114
- package/docs/VERIFIED-PROJECTS-VALIDATION.md +29 -29
- package/docs/VERIFIED-PROJECTS.md +167 -167
- package/docs/WINDOWS-RUNNER-VALIDATION.md +104 -0
- package/docs/assets/yoke-logo.png +0 -0
- package/docs/community-outreach-2026-08-20.md +85 -0
- package/docs/launch-copy-2026-08-21.md +193 -0
- package/docs/superpowers/plans/2026-06-28-baustein-e-context-layer.md +981 -981
- package/docs/superpowers/plans/2026-06-29-baustein-f-routing.md +258 -258
- package/docs/superpowers/plans/2026-06-29-baustein-g-loop-observability.md +1006 -1006
- package/docs/superpowers/plans/2026-06-29-baustein-h-loop-robustness.md +374 -374
- package/docs/superpowers/plans/2026-06-30-baustein-i-visual-design-verification.md +450 -450
- package/docs/superpowers/plans/2026-07-02-baustein-k-zero-to-100-bootstrap.md +1024 -1024
- package/docs/superpowers/plans/2026-07-02-baustein-m-flow-smoke-proofs.md +574 -574
- package/docs/superpowers/plans/2026-08-13-gauntlet-quality-loop.md +537 -537
- package/docs/superpowers/plans/2026-08-16-artifact-backed-output-compaction.md +329 -329
- package/docs/superpowers/plans/2026-09-05-verified-projects.md +83 -83
- package/docs/superpowers/specs/2026-06-28-baustein-e-context-layer-design.md +146 -146
- package/docs/superpowers/specs/2026-06-29-baustein-f-routing-design.md +106 -106
- package/docs/superpowers/specs/2026-06-29-baustein-g-loop-observability-design.md +186 -186
- package/docs/superpowers/specs/2026-06-29-baustein-h-loop-robustness-design.md +113 -113
- package/docs/superpowers/specs/2026-06-30-baustein-i-visual-design-verification-design.md +98 -98
- package/docs/superpowers/specs/2026-07-02-baustein-k-zero-to-100-bootstrap-design.md +200 -200
- package/docs/superpowers/specs/2026-07-02-baustein-m-flow-smoke-proofs-design.md +155 -155
- package/docs/superpowers/specs/2026-08-13-gauntlet-quality-loop-design.md +422 -422
- package/docs/superpowers/specs/2026-08-16-artifact-backed-output-compaction-design.md +166 -166
- package/gemini-extension.json +6 -6
- package/hooks/hooks.json +19 -19
- package/package.json +87 -87
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yoke-retrofit
|
|
3
|
-
description: Use when asked to "retrofit", "yoke this project", or set up the Yoke harness in a project — runs the shared setup wizard and configures the same behavior for Claude, Codex, and Gemini.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Yoke Retrofit
|
|
7
|
-
|
|
8
|
-
Set up or update Yoke through the shared `yoke setup` contract.
|
|
9
|
-
|
|
10
|
-
1. Inspect the project and identify the current host (`claude`, `codex`, or `gemini`).
|
|
11
|
-
2. Ask these setup questions one at a time and give a direct recommendation:
|
|
12
|
-
- target agents (recommend the current host; use `all` for deliberately cross-agent projects),
|
|
13
|
-
- code-graph tool,
|
|
14
|
-
- autonomous loop on/off,
|
|
15
|
-
- default runner (recommend the current host),
|
|
16
|
-
- decision mode: `auto` or `critical`.
|
|
17
|
-
3. Recommend the code graph based on this project:
|
|
18
|
-
- **Serena** is LSP-accurate and best for large typed codebases or systematic symbol refactors where a missed reference is costly. It needs a language server per language.
|
|
19
|
-
- **graphify** is fast and multimodal, and is best for exploration, migration, onboarding, or mixed code and document repositories. Its graph is an index and can become stale.
|
|
20
|
-
4. Apply the answers without a second round of prompts:
|
|
21
|
-
`yoke setup . --yes --host=<host> --agent=<agents> --code-graph=<choice> --runner=<runner> --decision-policy=<auto|critical> --loop|--no-loop`.
|
|
22
|
-
A human who runs `yoke setup .` directly receives the same five terminal questions.
|
|
23
|
-
5. Show the generated report and backup paths. Existing files are backed up under `.yoke/backup/`; settings are merged where supported.
|
|
24
|
-
6. If an old generated `CLAUDE.md` or `GEMINI.md` contained project-specific instructions, restore them inside its `<!-- yoke:preserve:start -->` / `<!-- yoke:preserve:end -->` block. Preserve blocks survive every later retrofit.
|
|
25
|
-
|
|
26
|
-
The generated harness includes the provider-neutral `yoke-workflow` skill. It owns the planning questions, approved-plan handoff, autonomous stories, and critical-decision resume flow.
|
|
1
|
+
---
|
|
2
|
+
name: yoke-retrofit
|
|
3
|
+
description: Use when asked to "retrofit", "yoke this project", or set up the Yoke harness in a project — runs the shared setup wizard and configures the same behavior for Claude, Codex, and Gemini.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Yoke Retrofit
|
|
7
|
+
|
|
8
|
+
Set up or update Yoke through the shared `yoke setup` contract.
|
|
9
|
+
|
|
10
|
+
1. Inspect the project and identify the current host (`claude`, `codex`, or `gemini`).
|
|
11
|
+
2. Ask these setup questions one at a time and give a direct recommendation:
|
|
12
|
+
- target agents (recommend the current host; use `all` for deliberately cross-agent projects),
|
|
13
|
+
- code-graph tool,
|
|
14
|
+
- autonomous loop on/off,
|
|
15
|
+
- default runner (recommend the current host),
|
|
16
|
+
- decision mode: `auto` or `critical`.
|
|
17
|
+
3. Recommend the code graph based on this project:
|
|
18
|
+
- **Serena** is LSP-accurate and best for large typed codebases or systematic symbol refactors where a missed reference is costly. It needs a language server per language.
|
|
19
|
+
- **graphify** is fast and multimodal, and is best for exploration, migration, onboarding, or mixed code and document repositories. Its graph is an index and can become stale.
|
|
20
|
+
4. Apply the answers without a second round of prompts:
|
|
21
|
+
`yoke setup . --yes --host=<host> --agent=<agents> --code-graph=<choice> --runner=<runner> --decision-policy=<auto|critical> --loop|--no-loop`.
|
|
22
|
+
A human who runs `yoke setup .` directly receives the same five terminal questions.
|
|
23
|
+
5. Show the generated report and backup paths. Existing files are backed up under `.yoke/backup/`; settings are merged where supported.
|
|
24
|
+
6. If an old generated `CLAUDE.md` or `GEMINI.md` contained project-specific instructions, restore them inside its `<!-- yoke:preserve:start -->` / `<!-- yoke:preserve:end -->` block. Preserve blocks survive every later retrofit.
|
|
25
|
+
|
|
26
|
+
The generated harness includes the provider-neutral `yoke-workflow` skill. It owns the planning questions, approved-plan handoff, autonomous stories, and critical-decision resume flow.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yoke-workflow
|
|
3
|
-
description: Use when the user asks Yoke to plan and build a feature, run stories autonomously, continue a Yoke loop, or only interrupt for major decisions.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Yoke Workflow
|
|
7
|
-
|
|
8
|
-
Provide the same interaction contract in Claude, Codex, and Gemini.
|
|
9
|
-
|
|
10
|
-
1. Read `.yoke/config.yaml`. If it is missing, offer `yoke setup . --host=<current-agent>` and run the setup flow before planning.
|
|
11
|
-
2. Plan before starting the loop. Inspect the project, then ask one focused question at a time only where the answer changes product behavior, scope, architecture, security, data ownership, external cost, or an irreversible choice. Include a recommended answer. Resolve routine implementation details yourself.
|
|
12
|
-
3. Summarize the agreed design in `.yoke/plan.md`, including goals, non-goals, constraints, and decisions. Use the `authoring-prd` skill to turn it into small stories with testable acceptance criteria. Run `yoke prd check .`.
|
|
13
|
-
4. Ask once for approval of the complete plan and story set. Do not begin implementation before that approval.
|
|
14
|
-
5. If `loop.enabled` is true, run the stories without routine follow-up questions using the configured runner. Prefer `yoke loop run . --max=5 --isolate`, report status after each batch, and continue until complete or genuinely blocked.
|
|
15
|
-
6. Respect `loop.decisionPolicy`:
|
|
16
|
-
- `auto`: choose the most suitable option from the plan, current code, and established conventions. Record the interpretation and continue.
|
|
17
|
-
- `critical`: routine ambiguity is still resolved automatically. If the loop reports a pending critical decision, run `yoke loop decision .`, present its options and recommendation to the user, ask exactly that question, then run `yoke loop answer . --choice=<id> --rationale="<answer>"`. The answer command records the decision and resumes the same story.
|
|
18
|
-
7. Never ask whether to run tests, review, commit, or continue to the next approved story. Those are part of the approved workflow.
|
|
19
|
-
|
|
20
|
-
The user's configured commit identity is authoritative. Do not add an AI co-author unless `commit.allowCoAuthors` explicitly permits it.
|
|
1
|
+
---
|
|
2
|
+
name: yoke-workflow
|
|
3
|
+
description: Use when the user asks Yoke to plan and build a feature, run stories autonomously, continue a Yoke loop, or only interrupt for major decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Yoke Workflow
|
|
7
|
+
|
|
8
|
+
Provide the same interaction contract in Claude, Codex, and Gemini.
|
|
9
|
+
|
|
10
|
+
1. Read `.yoke/config.yaml`. If it is missing, offer `yoke setup . --host=<current-agent>` and run the setup flow before planning.
|
|
11
|
+
2. Plan before starting the loop. Inspect the project, then ask one focused question at a time only where the answer changes product behavior, scope, architecture, security, data ownership, external cost, or an irreversible choice. Include a recommended answer. Resolve routine implementation details yourself.
|
|
12
|
+
3. Summarize the agreed design in `.yoke/plan.md`, including goals, non-goals, constraints, and decisions. Use the `authoring-prd` skill to turn it into small stories with testable acceptance criteria. Run `yoke prd check .`.
|
|
13
|
+
4. Ask once for approval of the complete plan and story set. Do not begin implementation before that approval.
|
|
14
|
+
5. If `loop.enabled` is true, run the stories without routine follow-up questions using the configured runner. Prefer `yoke loop run . --max=5 --isolate`, report status after each batch, and continue until complete or genuinely blocked.
|
|
15
|
+
6. Respect `loop.decisionPolicy`:
|
|
16
|
+
- `auto`: choose the most suitable option from the plan, current code, and established conventions. Record the interpretation and continue.
|
|
17
|
+
- `critical`: routine ambiguity is still resolved automatically. If the loop reports a pending critical decision, run `yoke loop decision .`, present its options and recommendation to the user, ask exactly that question, then run `yoke loop answer . --choice=<id> --rationale="<answer>"`. The answer command records the decision and resumes the same story.
|
|
18
|
+
7. Never ask whether to run tests, review, commit, or continue to the next approved story. Those are part of the approved workflow.
|
|
19
|
+
|
|
20
|
+
The user's configured commit identity is authoritative. Do not add an AI co-author unless `commit.allowCoAuthors` explicitly permits it.
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process'
|
|
2
|
-
import { resolve } from 'node:path'
|
|
3
|
-
import { pathToFileURL } from 'node:url'
|
|
4
|
-
|
|
5
|
-
function rtkCheck(command) {
|
|
6
|
-
const result = spawnSync('rtk', ['hook', 'check', command], { encoding: 'utf8', timeout: 3000 })
|
|
7
|
-
return result.status === 0 ? result.stdout.trim() : ''
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function rewriteHookInput(input, check = rtkCheck) {
|
|
11
|
-
if (input?.tool_name !== 'Bash' && input?.toolName !== 'Bash') return null
|
|
12
|
-
const toolInput = input.tool_input ?? input.toolInput
|
|
13
|
-
const command = toolInput?.command
|
|
14
|
-
if (typeof command !== 'string' || command.trim() === '') return null
|
|
15
|
-
const rewritten = check(command)
|
|
16
|
-
if (!rewritten || rewritten === command) return null
|
|
17
|
-
return {
|
|
18
|
-
hookSpecificOutput: {
|
|
19
|
-
hookEventName: 'PreToolUse',
|
|
20
|
-
updatedInput: { ...toolInput, command: rewritten },
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function main() {
|
|
26
|
-
let raw = ''
|
|
27
|
-
for await (const chunk of process.stdin) raw += chunk
|
|
28
|
-
try {
|
|
29
|
-
const output = rewriteHookInput(JSON.parse(raw))
|
|
30
|
-
if (output) process.stdout.write(JSON.stringify(output))
|
|
31
|
-
} catch {
|
|
32
|
-
// Compression is an optimization. Malformed input must never block Codex.
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.meta.url) await main()
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { pathToFileURL } from 'node:url'
|
|
4
|
+
|
|
5
|
+
function rtkCheck(command) {
|
|
6
|
+
const result = spawnSync('rtk', ['hook', 'check', command], { encoding: 'utf8', timeout: 3000 })
|
|
7
|
+
return result.status === 0 ? result.stdout.trim() : ''
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function rewriteHookInput(input, check = rtkCheck) {
|
|
11
|
+
if (input?.tool_name !== 'Bash' && input?.toolName !== 'Bash') return null
|
|
12
|
+
const toolInput = input.tool_input ?? input.toolInput
|
|
13
|
+
const command = toolInput?.command
|
|
14
|
+
if (typeof command !== 'string' || command.trim() === '') return null
|
|
15
|
+
const rewritten = check(command)
|
|
16
|
+
if (!rewritten || rewritten === command) return null
|
|
17
|
+
return {
|
|
18
|
+
hookSpecificOutput: {
|
|
19
|
+
hookEventName: 'PreToolUse',
|
|
20
|
+
updatedInput: { ...toolInput, command: rewritten },
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function main() {
|
|
26
|
+
let raw = ''
|
|
27
|
+
for await (const chunk of process.stdin) raw += chunk
|
|
28
|
+
try {
|
|
29
|
+
const output = rewriteHookInput(JSON.parse(raw))
|
|
30
|
+
if (output) process.stdout.write(JSON.stringify(output))
|
|
31
|
+
} catch {
|
|
32
|
+
// Compression is an optimization. Malformed input must never block Codex.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.meta.url) await main()
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Pure BeforeTool argument adapter. Never evaluates or executes tool commands.
|
|
3
|
-
import { readFileSync } from 'node:fs'
|
|
4
|
-
|
|
5
|
-
const record = value => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
6
|
-
try {
|
|
7
|
-
const event = JSON.parse(readFileSync(0, 'utf8'))
|
|
8
|
-
if (!record(event) || typeof event.tool_name !== 'string' ||
|
|
9
|
-
(event.hook_event_name !== undefined && event.hook_event_name !== 'BeforeTool')) throw new Error('event')
|
|
10
|
-
let response = {}
|
|
11
|
-
if (event.tool_name === 'run_shell_command') {
|
|
12
|
-
if (!record(event.tool_input) || typeof event.tool_input.command !== 'string' || !event.tool_input.command.trim() || event.tool_input.command.includes('\0')) throw new Error('command')
|
|
13
|
-
const command = event.tool_input.command
|
|
14
|
-
// Restrict rewriting to simple supported invocations. Leave shell syntax,
|
|
15
|
-
// quoted executables, assignments and existing RTK wrappers untouched.
|
|
16
|
-
if (!/[;&|<>`$\r\n()]/u.test(command) && /^\s*(?:git|rg|npm|npx|cargo|pytest|go|docker|kubectl)\s/u.test(command)) {
|
|
17
|
-
const rewritten = command.trimStart().replace(/^rg\s/u, 'grep ')
|
|
18
|
-
response = { hookSpecificOutput: { tool_input: { ...event.tool_input, command: `rtk ${rewritten}` } } }
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
process.stdout.write(JSON.stringify(response) + '\n')
|
|
22
|
-
} catch {
|
|
23
|
-
process.stderr.write('Invalid Gemini BeforeTool hook input\n')
|
|
24
|
-
process.exitCode = 2
|
|
25
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Pure BeforeTool argument adapter. Never evaluates or executes tool commands.
|
|
3
|
+
import { readFileSync } from 'node:fs'
|
|
4
|
+
|
|
5
|
+
const record = value => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
6
|
+
try {
|
|
7
|
+
const event = JSON.parse(readFileSync(0, 'utf8'))
|
|
8
|
+
if (!record(event) || typeof event.tool_name !== 'string' ||
|
|
9
|
+
(event.hook_event_name !== undefined && event.hook_event_name !== 'BeforeTool')) throw new Error('event')
|
|
10
|
+
let response = {}
|
|
11
|
+
if (event.tool_name === 'run_shell_command') {
|
|
12
|
+
if (!record(event.tool_input) || typeof event.tool_input.command !== 'string' || !event.tool_input.command.trim() || event.tool_input.command.includes('\0')) throw new Error('command')
|
|
13
|
+
const command = event.tool_input.command
|
|
14
|
+
// Restrict rewriting to simple supported invocations. Leave shell syntax,
|
|
15
|
+
// quoted executables, assignments and existing RTK wrappers untouched.
|
|
16
|
+
if (!/[;&|<>`$\r\n()]/u.test(command) && /^\s*(?:git|rg|npm|npx|cargo|pytest|go|docker|kubectl)\s/u.test(command)) {
|
|
17
|
+
const rewritten = command.trimStart().replace(/^rg\s/u, 'grep ')
|
|
18
|
+
response = { hookSpecificOutput: { tool_input: { ...event.tool_input, command: `rtk ${rewritten}` } } }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
process.stdout.write(JSON.stringify(response) + '\n')
|
|
22
|
+
} catch {
|
|
23
|
+
process.stderr.write('Invalid Gemini BeforeTool hook input\n')
|
|
24
|
+
process.exitCode = 2
|
|
25
|
+
}
|
package/canon/tools/graphify.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Tool: graphify (code-graph)
|
|
2
|
-
|
|
3
|
-
MIT, multimodal code/doc graph. Wired as an MCP server for all three agents (stdio). Prefer symbol/graph lookups over reading whole files. Caveat: heuristic edges (INFERRED/AMBIGUOUS) and a static index that can go stale — rebuild on significant changes.
|
|
1
|
+
# Tool: graphify (code-graph)
|
|
2
|
+
|
|
3
|
+
MIT, multimodal code/doc graph. Wired as an MCP server for all three agents (stdio). Prefer symbol/graph lookups over reading whole files. Caveat: heuristic edges (INFERRED/AMBIGUOUS) and a static index that can go stale — rebuild on significant changes.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Tool: Playwright MCP (browser / dogfooding)
|
|
2
|
-
|
|
3
|
-
Microsoft Playwright MCP, Apache-2.0. Wired as an MCP server for all three agents — the only browser tool with native MCP parity across Claude/Codex/Gemini. Used for QA, dogfooding user flows, screenshots, and deploy verification.
|
|
1
|
+
# Tool: Playwright MCP (browser / dogfooding)
|
|
2
|
+
|
|
3
|
+
Microsoft Playwright MCP, Apache-2.0. Wired as an MCP server for all three agents — the only browser tool with native MCP parity across Claude/Codex/Gemini. Used for QA, dogfooding user flows, screenshots, and deploy verification.
|
package/canon/tools/rtk.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Tool: rtk (token compression)
|
|
2
|
-
|
|
3
|
-
Per-agent wiring (generated by Baustein B):
|
|
4
|
-
|
|
5
|
-
- **Claude Code:** PreToolUse hook auto-rewrites commands (`git status` → `rtk git status`). On Windows this needs WSL; otherwise fall back to instruction mode (this file injected into CLAUDE.md telling the agent to prefix commands with `rtk`).
|
|
6
|
-
- **Codex CLI:** inject `RTK.md` / AGENTS.md instruction.
|
|
7
|
-
- **Gemini CLI:** no hook system — register rtk as an MCP tool or inject the GEMINI.md instruction.
|
|
1
|
+
# Tool: rtk (token compression)
|
|
2
|
+
|
|
3
|
+
Per-agent wiring (generated by Baustein B):
|
|
4
|
+
|
|
5
|
+
- **Claude Code:** PreToolUse hook auto-rewrites commands (`git status` → `rtk git status`). On Windows this needs WSL; otherwise fall back to instruction mode (this file injected into CLAUDE.md telling the agent to prefix commands with `rtk`).
|
|
6
|
+
- **Codex CLI:** inject `RTK.md` / AGENTS.md instruction.
|
|
7
|
+
- **Gemini CLI:** no hook system — register rtk as an MCP tool or inject the GEMINI.md instruction.
|
package/canon/tools/serena.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Tool: Serena (code-graph, LSP-accurate)
|
|
2
|
-
|
|
3
|
-
MIT, MCP-first. The alternative to graphify, selected via `yoke retrofit --code-graph=serena`. Serena uses real language servers (LSP) for symbol-accurate, cross-file retrieval and refactoring (`find_symbol`, `find_referencing_symbols`, rename/move) — no static index that goes stale, so it will not miss a reference.
|
|
4
|
-
|
|
5
|
-
Wired as an MCP server for all three agents. Best for large, strongly-typed codebases (TypeScript, Python, Go) doing systematic refactoring, where missing a caller is costly.
|
|
6
|
-
|
|
1
|
+
# Tool: Serena (code-graph, LSP-accurate)
|
|
2
|
+
|
|
3
|
+
MIT, MCP-first. The alternative to graphify, selected via `yoke retrofit --code-graph=serena`. Serena uses real language servers (LSP) for symbol-accurate, cross-file retrieval and refactoring (`find_symbol`, `find_referencing_symbols`, rename/move) — no static index that goes stale, so it will not miss a reference.
|
|
4
|
+
|
|
5
|
+
Wired as an MCP server for all three agents. Best for large, strongly-typed codebases (TypeScript, Python, Go) doing systematic refactoring, where missing a caller is costly.
|
|
6
|
+
|
|
7
7
|
Caveat: needs one language server per language (can be fiddly on Windows for exotic languages) and requires `uv`. The launch command is a best-effort template — adjust to your install, e.g. `uvx --from git+https://github.com/oraios/serena serena-mcp-server`.
|
|
8
8
|
|
|
9
9
|
Yoke disables Serena's automatic web-dashboard launch in generated MCP configurations. The
|
package/dist/agents/contracts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export const AgentSchema = z.enum(['claude', 'codex', 'gemini']);
|
|
2
|
+
export const AgentSchema = z.enum(['claude', 'codex', 'gemini', 'qwen']);
|
|
3
3
|
export const PermissionProfileSchema = z.enum(['safe', 'unsafe', 'read-only']);
|
|
4
4
|
export const ModelSelectionSchema = z.object({
|
|
5
5
|
model: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/).optional(),
|
package/dist/agents/host.js
CHANGED
|
@@ -7,12 +7,16 @@ export function detectHostAgent(env = process.env) {
|
|
|
7
7
|
return 'claude';
|
|
8
8
|
if (env.GEMINI_CLI)
|
|
9
9
|
return 'gemini';
|
|
10
|
+
if (env.QWEN_CLI)
|
|
11
|
+
return 'qwen';
|
|
10
12
|
if (env.CODEX_HOME)
|
|
11
13
|
return 'codex';
|
|
12
14
|
if (env.CLAUDE_CONFIG_DIR)
|
|
13
15
|
return 'claude';
|
|
14
16
|
if (env.GEMINI_CLI_HOME)
|
|
15
17
|
return 'gemini';
|
|
18
|
+
if (env.QWEN_CLI_HOME)
|
|
19
|
+
return 'qwen';
|
|
16
20
|
return undefined;
|
|
17
21
|
}
|
|
18
22
|
export function resolveRunnerAgent(config, explicit, host) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
|
-
const queryProcessIdentity = (command, args, options) => execFileSync(command, args, { stdio: 'pipe', ...options }).toString();
|
|
2
|
+
const queryProcessIdentity = (command, args, options) => execFileSync(command, args, { stdio: 'pipe', timeout: 5000, windowsHide: true, ...options }).toString();
|
|
3
3
|
export function processIncarnation(pid, platform = process.platform, query = queryProcessIdentity) {
|
|
4
4
|
try {
|
|
5
5
|
if (platform === 'win32') {
|
package/dist/agents/process.js
CHANGED
|
@@ -4,35 +4,64 @@ import { killProcessTreeForCleanup } from '../loop/watchdog.js';
|
|
|
4
4
|
import { createProviderProcessRecord, filesystemProviderProcessRecordAdapter, } from './process-record.js';
|
|
5
5
|
import { createBoundedOutput, createTelemetryAccumulator } from './process-streams.js';
|
|
6
6
|
import { processIncarnation } from './process-incarnation.js';
|
|
7
|
+
import { prepareWindowsInvocation, resolveWindowsCommand } from './windows-launch.js';
|
|
8
|
+
import { createSupervision, supervisionLimits, assertPreviousProvidersStopped } from './supervision.js';
|
|
7
9
|
function cancellationReason(signal) {
|
|
8
10
|
return typeof signal.reason === 'string' && signal.reason.length > 0
|
|
9
11
|
? signal.reason
|
|
10
12
|
: 'provider process cancellation requested';
|
|
11
13
|
}
|
|
12
14
|
export function providerSpawnOptions(invocation, platform = process.platform) {
|
|
13
|
-
const
|
|
15
|
+
const resolved = platform === 'win32' ? resolveWindowsCommand(invocation.command, invocation.args) : invocation;
|
|
14
16
|
return {
|
|
15
|
-
command:
|
|
16
|
-
args:
|
|
17
|
+
command: resolved.command,
|
|
18
|
+
args: resolved.args,
|
|
17
19
|
cwd: invocation.cwd,
|
|
18
|
-
shell:
|
|
20
|
+
shell: false,
|
|
19
21
|
detached: platform !== 'win32',
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
export function startProviderProcess(agent, invocation, options = {}) {
|
|
23
|
-
|
|
25
|
+
let failure = () => { };
|
|
26
|
+
let progress = () => { };
|
|
27
|
+
const limits = supervisionLimits(invocation.cwd);
|
|
28
|
+
const supervision = createSupervision(invocation.cwd, reason => failure(reason), () => progress(), options.attempt);
|
|
29
|
+
let prepared;
|
|
30
|
+
try {
|
|
31
|
+
assertPreviousProvidersStopped(invocation.cwd);
|
|
32
|
+
prepared = process.platform === 'win32' ? prepareWindowsInvocation(invocation) : { command: invocation.command, args: invocation.args, env: process.env };
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const message = error.message;
|
|
36
|
+
supervision.stop(message);
|
|
37
|
+
return { pid: undefined, invocation, recordPath: '', cancel: () => false, completion: Promise.resolve({ kind: 'spawn-failed', error: message, invocation, pid: undefined, stdout: '', stderr: '', stdoutTruncated: false, stderrTruncated: false, telemetry: { usageAvailable: false } }) };
|
|
38
|
+
}
|
|
39
|
+
const spawnOptions = { ...prepared, cwd: invocation.cwd, shell: false, detached: process.platform !== 'win32' };
|
|
24
40
|
const child = spawn(spawnOptions.command, [...spawnOptions.args], {
|
|
25
41
|
cwd: spawnOptions.cwd,
|
|
26
42
|
shell: spawnOptions.shell,
|
|
27
43
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
28
44
|
detached: spawnOptions.detached,
|
|
45
|
+
env: prepared.env,
|
|
46
|
+
windowsHide: true,
|
|
29
47
|
});
|
|
30
48
|
const targetDir = resolve(invocation.cwd);
|
|
31
49
|
const pid = child.pid;
|
|
32
50
|
const startedAt = pid === undefined ? `unverified:${new Date().toISOString()}` : processIncarnation(pid) ?? `unverified:${new Date().toISOString()}`;
|
|
51
|
+
supervision.start(pid, 'shell' in prepared ? prepared.shell : undefined, startedAt.startsWith('unverified:') ? undefined : startedAt);
|
|
33
52
|
const record = createProviderProcessRecord(targetDir, pid ?? 0, options.workerId, startedAt);
|
|
34
53
|
const recordAdapter = options.recordAdapter ?? filesystemProviderProcessRecordAdapter;
|
|
35
|
-
const terminateProcessTree = options.terminateProcessTree ?? ((processPid) =>
|
|
54
|
+
const terminateProcessTree = options.terminateProcessTree ?? ((processPid) => {
|
|
55
|
+
try {
|
|
56
|
+
process.kill(processPid, 0);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
if (startedAt.startsWith('unverified:') || processIncarnation(processPid) !== startedAt)
|
|
62
|
+
return false;
|
|
63
|
+
return killProcessTreeForCleanup(processPid);
|
|
64
|
+
});
|
|
36
65
|
let recordPublished = false;
|
|
37
66
|
const stdout = createBoundedOutput(options.outputLimitBytes ?? 1_048_576);
|
|
38
67
|
const stderr = createBoundedOutput(options.outputLimitBytes ?? 1_048_576);
|
|
@@ -42,6 +71,9 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
42
71
|
let termination;
|
|
43
72
|
let idleTimer;
|
|
44
73
|
let forceTimer;
|
|
74
|
+
let totalTimer;
|
|
75
|
+
let progressTimer;
|
|
76
|
+
let completionTimer;
|
|
45
77
|
let recordFailure;
|
|
46
78
|
let terminationConfirmed = false;
|
|
47
79
|
let settled = false;
|
|
@@ -58,6 +90,12 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
58
90
|
clearTimeout(idleTimer);
|
|
59
91
|
if (forceTimer)
|
|
60
92
|
clearTimeout(forceTimer);
|
|
93
|
+
if (totalTimer)
|
|
94
|
+
clearTimeout(totalTimer);
|
|
95
|
+
if (progressTimer)
|
|
96
|
+
clearTimeout(progressTimer);
|
|
97
|
+
if (completionTimer)
|
|
98
|
+
clearTimeout(completionTimer);
|
|
61
99
|
idleTimer = undefined;
|
|
62
100
|
forceTimer = undefined;
|
|
63
101
|
};
|
|
@@ -66,6 +104,7 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
66
104
|
return;
|
|
67
105
|
settled = true;
|
|
68
106
|
clearTimers();
|
|
107
|
+
supervision.stop(termination?.reason ?? (result.kind === 'succeeded' ? 'provider-exited' : 'provider-failed'), !termination || terminationConfirmed);
|
|
69
108
|
options.signal?.removeEventListener('abort', onAbort);
|
|
70
109
|
if (!termination || terminationConfirmed)
|
|
71
110
|
removeRecord();
|
|
@@ -81,6 +120,9 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
81
120
|
telemetry: telemetry.finish(),
|
|
82
121
|
});
|
|
83
122
|
const finalize = (exitCode) => {
|
|
123
|
+
if (settled)
|
|
124
|
+
return;
|
|
125
|
+
supervision.flush();
|
|
84
126
|
// Windows can emit close before taskkill's process-tree state is observable.
|
|
85
127
|
// Reconfirm here so successful termination does not leave a stale ownership record.
|
|
86
128
|
if (termination && pid !== undefined && !terminationConfirmed) {
|
|
@@ -114,6 +156,21 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
114
156
|
forceTimer = setTimeout(() => {
|
|
115
157
|
if (pid !== undefined && !settled)
|
|
116
158
|
terminationConfirmed = terminateProcessTree(pid, true);
|
|
159
|
+
// Allow close/pipe draining to confirm termination before the bounded fallback.
|
|
160
|
+
if (!settled)
|
|
161
|
+
completionTimer = setTimeout(() => {
|
|
162
|
+
if (settled)
|
|
163
|
+
return;
|
|
164
|
+
// A killer's return value is not an observed process exit.
|
|
165
|
+
if (pid !== undefined) {
|
|
166
|
+
try {
|
|
167
|
+
process.kill(pid, 0);
|
|
168
|
+
terminationConfirmed = false;
|
|
169
|
+
}
|
|
170
|
+
catch { /* exited */ }
|
|
171
|
+
}
|
|
172
|
+
finalize(null);
|
|
173
|
+
}, 5000);
|
|
117
174
|
}, terminationGraceMs);
|
|
118
175
|
return true;
|
|
119
176
|
};
|
|
@@ -140,8 +197,16 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
140
197
|
stderr.append(text);
|
|
141
198
|
}
|
|
142
199
|
options.onOutput?.({ stream, text });
|
|
200
|
+
supervision.output(stream, text);
|
|
143
201
|
armIdleTimer();
|
|
144
202
|
};
|
|
203
|
+
failure = reason => { terminate({ kind: 'cancelled', reason }); };
|
|
204
|
+
progress = () => {
|
|
205
|
+
if (progressTimer)
|
|
206
|
+
clearTimeout(progressTimer);
|
|
207
|
+
if ((options.progressTimeoutMs ?? limits.progressMs) > 0)
|
|
208
|
+
progressTimer = setTimeout(() => terminate({ kind: 'timed-out', reason: 'provider-progress-timeout' }), options.progressTimeoutMs ?? limits.progressMs);
|
|
209
|
+
};
|
|
145
210
|
child.stdout?.on('data', chunk => { onOutput('stdout', chunk); });
|
|
146
211
|
child.stderr?.on('data', chunk => { onOutput('stderr', chunk); });
|
|
147
212
|
child.stdin?.on('error', () => { });
|
|
@@ -178,5 +243,8 @@ export function startProviderProcess(agent, invocation, options = {}) {
|
|
|
178
243
|
else
|
|
179
244
|
options.signal?.addEventListener('abort', onAbort, { once: true });
|
|
180
245
|
armIdleTimer();
|
|
246
|
+
if ((options.totalTimeoutMs ?? limits.totalMs) > 0)
|
|
247
|
+
totalTimer = setTimeout(() => terminate({ kind: 'timed-out', reason: 'provider-total-timeout' }), options.totalTimeoutMs ?? limits.totalMs);
|
|
248
|
+
progress();
|
|
181
249
|
return handle;
|
|
182
250
|
}
|
package/dist/agents/providers.js
CHANGED
|
@@ -17,6 +17,13 @@ const argsFor = (agent, permissions) => {
|
|
|
17
17
|
// Automatic review already selects workspace-write and conflicts with --sandbox.
|
|
18
18
|
return ['exec', '--approve-for-me', '--json'];
|
|
19
19
|
}
|
|
20
|
+
// Qwen CLI is a Gemini fork with similar arguments
|
|
21
|
+
if (agent === 'qwen') {
|
|
22
|
+
if (permissions === 'unsafe')
|
|
23
|
+
return ['--yolo', '--output-format', 'stream-json'];
|
|
24
|
+
const approval = permissions === 'read-only' ? 'plan' : 'auto_edit';
|
|
25
|
+
return ['--approval-mode', approval, '--sandbox', '--output-format', 'stream-json'];
|
|
26
|
+
}
|
|
20
27
|
if (permissions === 'unsafe')
|
|
21
28
|
return ['--yolo', '--output-format', 'stream-json'];
|
|
22
29
|
const approval = permissions === 'read-only' ? 'plan' : 'auto_edit';
|
|
@@ -30,6 +37,12 @@ export function buildProviderInvocation(agent, prompt, cwd, permissions = 'safe'
|
|
|
30
37
|
throw new Error('Gemini does not support the reasoningEffort selection');
|
|
31
38
|
if (agent === 'gemini' && parsedSelection.nativeMultiAgent === true)
|
|
32
39
|
throw new Error('Gemini does not support enabling the nativeMultiAgent selection');
|
|
40
|
+
if (agent === 'qwen' && parsedSelection.bare)
|
|
41
|
+
throw new Error('Qwen does not support the bare startup selection');
|
|
42
|
+
if (agent === 'qwen' && parsedSelection.reasoningEffort)
|
|
43
|
+
throw new Error('Qwen does not support the reasoningEffort selection');
|
|
44
|
+
if (agent === 'qwen' && parsedSelection.nativeMultiAgent === true)
|
|
45
|
+
throw new Error('Qwen does not support enabling the nativeMultiAgent selection');
|
|
33
46
|
const args = argsFor(agent, permissions);
|
|
34
47
|
if (output.schemaFile !== undefined || output.jsonSchema !== undefined) {
|
|
35
48
|
if (agent === 'codex' && output.schemaFile && output.jsonSchema === undefined) {
|