@wazir-dev/cli 1.0.0 → 1.2.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/CHANGELOG.md +100 -2
- package/README.md +6 -6
- package/docs/concepts/architecture.md +1 -1
- package/docs/concepts/roles-and-workflows.md +2 -0
- package/docs/concepts/why-wazir.md +59 -0
- package/docs/decisions/2026-03-19-deferred-items.md +564 -0
- package/docs/decisions/2026-03-19-enhancement-decisions.md +300 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +1 -1
- package/docs/readmes/INDEX.md +21 -5
- package/docs/readmes/features/expertise/README.md +2 -2
- package/docs/readmes/features/exports/README.md +2 -2
- package/docs/readmes/features/schemas/README.md +3 -0
- package/docs/readmes/features/skills/README.md +17 -0
- package/docs/readmes/features/skills/clarifier.md +5 -0
- package/docs/readmes/features/skills/claude-cli.md +5 -0
- package/docs/readmes/features/skills/codex-cli.md +5 -0
- package/docs/readmes/features/skills/dispatching-parallel-agents.md +5 -0
- package/docs/readmes/features/skills/executing-plans.md +5 -0
- package/docs/readmes/features/skills/executor.md +5 -0
- package/docs/readmes/features/skills/finishing-a-development-branch.md +5 -0
- package/docs/readmes/features/skills/gemini-cli.md +5 -0
- package/docs/readmes/features/skills/humanize.md +5 -0
- package/docs/readmes/features/skills/init-pipeline.md +5 -0
- package/docs/readmes/features/skills/receiving-code-review.md +5 -0
- package/docs/readmes/features/skills/requesting-code-review.md +5 -0
- package/docs/readmes/features/skills/reviewer.md +5 -0
- package/docs/readmes/features/skills/subagent-driven-development.md +5 -0
- package/docs/readmes/features/skills/using-git-worktrees.md +5 -0
- package/docs/readmes/features/skills/wazir.md +5 -0
- package/docs/readmes/features/skills/writing-skills.md +5 -0
- package/docs/readmes/features/workflows/prepare-next.md +1 -1
- package/docs/reference/configuration-reference.md +47 -6
- package/docs/reference/launch-checklist.md +4 -4
- package/docs/reference/review-loop-pattern.md +538 -0
- package/docs/reference/roles-reference.md +1 -0
- package/docs/reference/skill-tiers.md +147 -0
- package/docs/reference/tooling-cli.md +5 -1
- package/docs/truth-claims.yaml +18 -0
- package/expertise/antipatterns/process/ai-coding-antipatterns.md +97 -1
- package/exports/hosts/claude/.claude/agents/clarifier.md +3 -0
- package/exports/hosts/claude/.claude/agents/designer.md +3 -0
- package/exports/hosts/claude/.claude/agents/executor.md +2 -0
- package/exports/hosts/claude/.claude/agents/planner.md +3 -0
- package/exports/hosts/claude/.claude/agents/researcher.md +2 -0
- package/exports/hosts/claude/.claude/agents/reviewer.md +5 -1
- package/exports/hosts/claude/.claude/agents/specifier.md +3 -0
- package/exports/hosts/claude/.claude/commands/clarify.md +4 -0
- package/exports/hosts/claude/.claude/commands/design-review.md +4 -0
- package/exports/hosts/claude/.claude/commands/design.md +4 -0
- package/exports/hosts/claude/.claude/commands/discover.md +4 -0
- package/exports/hosts/claude/.claude/commands/execute.md +4 -0
- package/exports/hosts/claude/.claude/commands/plan-review.md +4 -0
- package/exports/hosts/claude/.claude/commands/plan.md +4 -0
- package/exports/hosts/claude/.claude/commands/spec-challenge.md +4 -0
- package/exports/hosts/claude/.claude/commands/specify.md +4 -0
- package/exports/hosts/claude/.claude/commands/verify.md +4 -0
- package/exports/hosts/claude/.claude/settings.json +9 -0
- package/exports/hosts/claude/CLAUDE.md +1 -1
- package/exports/hosts/claude/export.manifest.json +22 -20
- package/exports/hosts/claude/host-package.json +3 -1
- package/exports/hosts/codex/AGENTS.md +1 -1
- package/exports/hosts/codex/export.manifest.json +22 -20
- package/exports/hosts/codex/host-package.json +3 -1
- package/exports/hosts/cursor/.cursor/hooks.json +4 -0
- package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +1 -1
- package/exports/hosts/cursor/export.manifest.json +22 -20
- package/exports/hosts/cursor/host-package.json +3 -1
- package/exports/hosts/gemini/GEMINI.md +1 -1
- package/exports/hosts/gemini/export.manifest.json +22 -20
- package/exports/hosts/gemini/host-package.json +3 -1
- package/hooks/context-mode-router +191 -0
- package/hooks/definitions/context_mode_router.yaml +19 -0
- package/hooks/definitions/loop_cap_guard.yaml +1 -1
- package/hooks/hooks.json +43 -0
- package/hooks/protected-path-write-guard +8 -0
- package/hooks/routing-matrix.json +45 -0
- package/hooks/session-start +62 -1
- package/llms-full.txt +905 -132
- package/package.json +3 -3
- package/roles/clarifier.md +3 -0
- package/roles/designer.md +3 -0
- package/roles/executor.md +2 -0
- package/roles/planner.md +3 -0
- package/roles/researcher.md +2 -0
- package/roles/reviewer.md +5 -1
- package/roles/specifier.md +3 -0
- package/schemas/hook.schema.json +2 -1
- package/schemas/phase-report.schema.json +80 -0
- package/schemas/usage.schema.json +25 -1
- package/schemas/wazir-manifest.schema.json +19 -0
- package/skills/brainstorming/SKILL.md +20 -56
- package/skills/clarifier/SKILL.md +243 -0
- package/skills/claude-cli/SKILL.md +320 -0
- package/skills/codex-cli/SKILL.md +260 -0
- package/skills/debugging/SKILL.md +24 -1
- package/skills/design/SKILL.md +13 -0
- package/skills/dispatching-parallel-agents/SKILL.md +13 -0
- package/skills/executing-plans/SKILL.md +28 -2
- package/skills/executor/SKILL.md +129 -0
- package/skills/finishing-a-development-branch/SKILL.md +13 -0
- package/skills/gemini-cli/SKILL.md +260 -0
- package/skills/humanize/SKILL.md +13 -0
- package/skills/init-pipeline/SKILL.md +76 -78
- package/skills/prepare-next/SKILL.md +81 -10
- package/skills/receiving-code-review/SKILL.md +21 -0
- package/skills/requesting-code-review/SKILL.md +38 -5
- package/skills/reviewer/SKILL.md +423 -0
- package/skills/run-audit/SKILL.md +13 -0
- package/skills/scan-project/SKILL.md +13 -0
- package/skills/self-audit/SKILL.md +197 -16
- package/skills/subagent-driven-development/SKILL.md +38 -2
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +2 -0
- package/skills/subagent-driven-development/implementer-prompt.md +8 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +7 -0
- package/skills/tdd/SKILL.md +21 -0
- package/skills/using-git-worktrees/SKILL.md +13 -0
- package/skills/using-skills/SKILL.md +13 -0
- package/skills/verification/SKILL.md +13 -0
- package/skills/wazir/SKILL.md +286 -262
- package/skills/writing-plans/SKILL.md +44 -4
- package/skills/writing-skills/SKILL.md +13 -0
- package/templates/artifacts/implementation-plan.md +3 -0
- package/templates/artifacts/tasks-template.md +133 -0
- package/templates/examples/phase-report.example.json +48 -0
- package/templates/examples/wazir-manifest.example.yaml +1 -1
- package/tooling/src/adapters/composition-engine.js +256 -0
- package/tooling/src/adapters/model-router.js +84 -0
- package/tooling/src/capture/command.js +111 -2
- package/tooling/src/capture/run-config.js +23 -0
- package/tooling/src/capture/store.js +24 -0
- package/tooling/src/capture/usage.js +106 -0
- package/tooling/src/checks/ac-matrix.js +256 -0
- package/tooling/src/checks/brand-truth.js +3 -6
- package/tooling/src/checks/command-registry.js +13 -0
- package/tooling/src/checks/docs-truth.js +1 -1
- package/tooling/src/checks/runtime-surface.js +3 -7
- package/tooling/src/checks/skills.js +111 -0
- package/tooling/src/cli.js +17 -3
- package/tooling/src/commands/stats.js +161 -0
- package/tooling/src/commands/validate.js +5 -1
- package/tooling/src/export/compiler.js +33 -37
- package/tooling/src/gating/agent.js +145 -0
- package/tooling/src/guards/phase-prerequisite-guard.js +127 -0
- package/tooling/src/hooks/routing-logic.js +69 -0
- package/tooling/src/init/auto-detect.js +260 -0
- package/tooling/src/init/command.js +161 -0
- package/tooling/src/input/scanner.js +46 -0
- package/tooling/src/reports/command.js +103 -0
- package/tooling/src/reports/phase-report.js +323 -0
- package/tooling/src/state/command.js +160 -0
- package/tooling/src/state/db.js +287 -0
- package/tooling/src/status/command.js +53 -1
- package/wazir.manifest.yaml +26 -17
- package/workflows/clarify.md +4 -0
- package/workflows/design-review.md +4 -0
- package/workflows/design.md +4 -0
- package/workflows/discover.md +4 -0
- package/workflows/execute.md +4 -0
- package/workflows/plan-review.md +4 -0
- package/workflows/plan.md +4 -0
- package/workflows/spec-challenge.md +4 -0
- package/workflows/specify.md +4 -0
- package/workflows/verify.md +4 -0
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"host": "claude",
|
|
3
3
|
"source_hashes": {
|
|
4
|
-
"wazir.manifest.yaml": "
|
|
5
|
-
"roles/clarifier.md": "
|
|
4
|
+
"wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
|
|
5
|
+
"roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
|
|
6
6
|
"roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
|
|
7
|
-
"roles/designer.md": "
|
|
8
|
-
"roles/executor.md": "
|
|
7
|
+
"roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
|
|
8
|
+
"roles/executor.md": "874625f62fb4bcce70c3d1554152e0e2cd3345cfe34220eec9fa0027b19c750c",
|
|
9
9
|
"roles/learner.md": "4a7e4635c0fbd2def794f017ca6ef5d47b6ea8dfaa5e85eeeecece61256f21a1",
|
|
10
|
-
"roles/planner.md": "
|
|
11
|
-
"roles/researcher.md": "
|
|
12
|
-
"roles/reviewer.md": "
|
|
13
|
-
"roles/specifier.md": "
|
|
10
|
+
"roles/planner.md": "07ef01bf1d4a1addda2172381013087f69aa91b4b239320ee253640d6db618cb",
|
|
11
|
+
"roles/researcher.md": "b2b9e9d79d7b8194603ae3d22d9f8cc994d60384e8de1b4c6b6559410523e0b9",
|
|
12
|
+
"roles/reviewer.md": "dd97b74152b5bd0472987d6e4660d693ebe75d5c067e17df4725f897156d014e",
|
|
13
|
+
"roles/specifier.md": "2d4cd45380fc6c68c7e05117165ae28853237cdffc58e712a5ebd7c1ce69b76e",
|
|
14
14
|
"roles/verifier.md": "ce8e200439190643a02ffe31f72e4b4ec319ccff9f0841cc3138eb517af5fed3",
|
|
15
15
|
"workflows/author.md": "81844443743540b21dd990fa93e59d8898216e498acde920e7007f8b81cef107",
|
|
16
|
-
"workflows/clarify.md": "
|
|
17
|
-
"workflows/design-review.md": "
|
|
18
|
-
"workflows/design.md": "
|
|
19
|
-
"workflows/discover.md": "
|
|
20
|
-
"workflows/execute.md": "
|
|
16
|
+
"workflows/clarify.md": "6db1bc65a61e3227649ed65f15de9a88500ea4239b388918c82d474ef92f0030",
|
|
17
|
+
"workflows/design-review.md": "96e454283af28f02a4d7b03f4edfa5c00d02107fcfa3d0c8f19e640f56027845",
|
|
18
|
+
"workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
|
|
19
|
+
"workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
|
|
20
|
+
"workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
|
|
21
21
|
"workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
|
|
22
|
-
"workflows/plan-review.md": "
|
|
23
|
-
"workflows/plan.md": "
|
|
22
|
+
"workflows/plan-review.md": "8696c472cb4605a171fd4ac8a9c51b7cf337807c4881ed163515dc56e61fd818",
|
|
23
|
+
"workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
|
|
24
24
|
"workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
|
|
25
25
|
"workflows/review.md": "aaeaf7ab4515e325084a77e75e18b325295f8d16799f71f8b7cd0ec67c52c0d6",
|
|
26
26
|
"workflows/run-audit.md": "e582f767967dc3fb6aaeb938ad1672e7bed18bf044055ce8c45c2114251b787a",
|
|
27
|
-
"workflows/spec-challenge.md": "
|
|
28
|
-
"workflows/specify.md": "
|
|
29
|
-
"workflows/verify.md": "
|
|
30
|
-
"hooks/definitions/
|
|
27
|
+
"workflows/spec-challenge.md": "dc99137c28c49a6f8312924709afb6077754d128e90466dc911150ce15737897",
|
|
28
|
+
"workflows/specify.md": "53b84e74871f6dbd93cae22a881cc5907e398b29501d0a1fa08c7ed69df705cb",
|
|
29
|
+
"workflows/verify.md": "45f9c189520dfe9d24c0bc340a15e6a80c988fca1b84dc187627032a6dbaee16",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml": "a10dc927418bc130b447eb33faf0f45669ecd9c7917f56947ddd74850a4e0e37",
|
|
31
|
+
"hooks/definitions/loop_cap_guard.yaml": "f0fd220e028ab6fad3d8fd650602884fe500ca4899eff6e428cf217af058618d",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
|
|
35
36
|
"hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
|
|
38
|
+
"hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
"workflows/spec-challenge.md",
|
|
28
28
|
"workflows/specify.md",
|
|
29
29
|
"workflows/verify.md",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml",
|
|
30
31
|
"hooks/definitions/loop_cap_guard.yaml",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml",
|
|
35
36
|
"hooks/definitions/session_start.yaml",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml",
|
|
38
|
+
"hooks/hooks.json"
|
|
37
39
|
],
|
|
38
40
|
"files": [
|
|
39
41
|
".claude/agents/clarifier.md",
|
|
@@ -6,7 +6,7 @@ This host package is generated from the canonical Wazir sources.
|
|
|
6
6
|
|
|
7
7
|
- project: Wazir
|
|
8
8
|
- hosts: claude, codex, gemini, cursor
|
|
9
|
-
- phases:
|
|
9
|
+
- phases: init, clarifier, executor, final_review
|
|
10
10
|
- roles: clarifier, researcher, specifier, content-author, designer, planner, executor, verifier, reviewer, learner
|
|
11
11
|
- protected paths: input, roles, workflows, schemas, exports/hosts
|
|
12
12
|
- state root default: ~/.wazir/projects/{project_slug}
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"host": "codex",
|
|
3
3
|
"source_hashes": {
|
|
4
|
-
"wazir.manifest.yaml": "
|
|
5
|
-
"roles/clarifier.md": "
|
|
4
|
+
"wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
|
|
5
|
+
"roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
|
|
6
6
|
"roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
|
|
7
|
-
"roles/designer.md": "
|
|
8
|
-
"roles/executor.md": "
|
|
7
|
+
"roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
|
|
8
|
+
"roles/executor.md": "874625f62fb4bcce70c3d1554152e0e2cd3345cfe34220eec9fa0027b19c750c",
|
|
9
9
|
"roles/learner.md": "4a7e4635c0fbd2def794f017ca6ef5d47b6ea8dfaa5e85eeeecece61256f21a1",
|
|
10
|
-
"roles/planner.md": "
|
|
11
|
-
"roles/researcher.md": "
|
|
12
|
-
"roles/reviewer.md": "
|
|
13
|
-
"roles/specifier.md": "
|
|
10
|
+
"roles/planner.md": "07ef01bf1d4a1addda2172381013087f69aa91b4b239320ee253640d6db618cb",
|
|
11
|
+
"roles/researcher.md": "b2b9e9d79d7b8194603ae3d22d9f8cc994d60384e8de1b4c6b6559410523e0b9",
|
|
12
|
+
"roles/reviewer.md": "dd97b74152b5bd0472987d6e4660d693ebe75d5c067e17df4725f897156d014e",
|
|
13
|
+
"roles/specifier.md": "2d4cd45380fc6c68c7e05117165ae28853237cdffc58e712a5ebd7c1ce69b76e",
|
|
14
14
|
"roles/verifier.md": "ce8e200439190643a02ffe31f72e4b4ec319ccff9f0841cc3138eb517af5fed3",
|
|
15
15
|
"workflows/author.md": "81844443743540b21dd990fa93e59d8898216e498acde920e7007f8b81cef107",
|
|
16
|
-
"workflows/clarify.md": "
|
|
17
|
-
"workflows/design-review.md": "
|
|
18
|
-
"workflows/design.md": "
|
|
19
|
-
"workflows/discover.md": "
|
|
20
|
-
"workflows/execute.md": "
|
|
16
|
+
"workflows/clarify.md": "6db1bc65a61e3227649ed65f15de9a88500ea4239b388918c82d474ef92f0030",
|
|
17
|
+
"workflows/design-review.md": "96e454283af28f02a4d7b03f4edfa5c00d02107fcfa3d0c8f19e640f56027845",
|
|
18
|
+
"workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
|
|
19
|
+
"workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
|
|
20
|
+
"workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
|
|
21
21
|
"workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
|
|
22
|
-
"workflows/plan-review.md": "
|
|
23
|
-
"workflows/plan.md": "
|
|
22
|
+
"workflows/plan-review.md": "8696c472cb4605a171fd4ac8a9c51b7cf337807c4881ed163515dc56e61fd818",
|
|
23
|
+
"workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
|
|
24
24
|
"workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
|
|
25
25
|
"workflows/review.md": "aaeaf7ab4515e325084a77e75e18b325295f8d16799f71f8b7cd0ec67c52c0d6",
|
|
26
26
|
"workflows/run-audit.md": "e582f767967dc3fb6aaeb938ad1672e7bed18bf044055ce8c45c2114251b787a",
|
|
27
|
-
"workflows/spec-challenge.md": "
|
|
28
|
-
"workflows/specify.md": "
|
|
29
|
-
"workflows/verify.md": "
|
|
30
|
-
"hooks/definitions/
|
|
27
|
+
"workflows/spec-challenge.md": "dc99137c28c49a6f8312924709afb6077754d128e90466dc911150ce15737897",
|
|
28
|
+
"workflows/specify.md": "53b84e74871f6dbd93cae22a881cc5907e398b29501d0a1fa08c7ed69df705cb",
|
|
29
|
+
"workflows/verify.md": "45f9c189520dfe9d24c0bc340a15e6a80c988fca1b84dc187627032a6dbaee16",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml": "a10dc927418bc130b447eb33faf0f45669ecd9c7917f56947ddd74850a4e0e37",
|
|
31
|
+
"hooks/definitions/loop_cap_guard.yaml": "f0fd220e028ab6fad3d8fd650602884fe500ca4899eff6e428cf217af058618d",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
|
|
35
36
|
"hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
|
|
38
|
+
"hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
"workflows/spec-challenge.md",
|
|
28
28
|
"workflows/specify.md",
|
|
29
29
|
"workflows/verify.md",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml",
|
|
30
31
|
"hooks/definitions/loop_cap_guard.yaml",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml",
|
|
35
36
|
"hooks/definitions/session_start.yaml",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml",
|
|
38
|
+
"hooks/hooks.json"
|
|
37
39
|
],
|
|
38
40
|
"files": [
|
|
39
41
|
"AGENTS.md"
|
|
@@ -6,7 +6,7 @@ This host package is generated from the canonical Wazir sources.
|
|
|
6
6
|
|
|
7
7
|
- project: Wazir
|
|
8
8
|
- hosts: claude, codex, gemini, cursor
|
|
9
|
-
- phases:
|
|
9
|
+
- phases: init, clarifier, executor, final_review
|
|
10
10
|
- roles: clarifier, researcher, specifier, content-author, designer, planner, executor, verifier, reviewer, learner
|
|
11
11
|
- protected paths: input, roles, workflows, schemas, exports/hosts
|
|
12
12
|
- state root default: ~/.wazir/projects/{project_slug}
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"host": "cursor",
|
|
3
3
|
"source_hashes": {
|
|
4
|
-
"wazir.manifest.yaml": "
|
|
5
|
-
"roles/clarifier.md": "
|
|
4
|
+
"wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
|
|
5
|
+
"roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
|
|
6
6
|
"roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
|
|
7
|
-
"roles/designer.md": "
|
|
8
|
-
"roles/executor.md": "
|
|
7
|
+
"roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
|
|
8
|
+
"roles/executor.md": "874625f62fb4bcce70c3d1554152e0e2cd3345cfe34220eec9fa0027b19c750c",
|
|
9
9
|
"roles/learner.md": "4a7e4635c0fbd2def794f017ca6ef5d47b6ea8dfaa5e85eeeecece61256f21a1",
|
|
10
|
-
"roles/planner.md": "
|
|
11
|
-
"roles/researcher.md": "
|
|
12
|
-
"roles/reviewer.md": "
|
|
13
|
-
"roles/specifier.md": "
|
|
10
|
+
"roles/planner.md": "07ef01bf1d4a1addda2172381013087f69aa91b4b239320ee253640d6db618cb",
|
|
11
|
+
"roles/researcher.md": "b2b9e9d79d7b8194603ae3d22d9f8cc994d60384e8de1b4c6b6559410523e0b9",
|
|
12
|
+
"roles/reviewer.md": "dd97b74152b5bd0472987d6e4660d693ebe75d5c067e17df4725f897156d014e",
|
|
13
|
+
"roles/specifier.md": "2d4cd45380fc6c68c7e05117165ae28853237cdffc58e712a5ebd7c1ce69b76e",
|
|
14
14
|
"roles/verifier.md": "ce8e200439190643a02ffe31f72e4b4ec319ccff9f0841cc3138eb517af5fed3",
|
|
15
15
|
"workflows/author.md": "81844443743540b21dd990fa93e59d8898216e498acde920e7007f8b81cef107",
|
|
16
|
-
"workflows/clarify.md": "
|
|
17
|
-
"workflows/design-review.md": "
|
|
18
|
-
"workflows/design.md": "
|
|
19
|
-
"workflows/discover.md": "
|
|
20
|
-
"workflows/execute.md": "
|
|
16
|
+
"workflows/clarify.md": "6db1bc65a61e3227649ed65f15de9a88500ea4239b388918c82d474ef92f0030",
|
|
17
|
+
"workflows/design-review.md": "96e454283af28f02a4d7b03f4edfa5c00d02107fcfa3d0c8f19e640f56027845",
|
|
18
|
+
"workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
|
|
19
|
+
"workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
|
|
20
|
+
"workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
|
|
21
21
|
"workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
|
|
22
|
-
"workflows/plan-review.md": "
|
|
23
|
-
"workflows/plan.md": "
|
|
22
|
+
"workflows/plan-review.md": "8696c472cb4605a171fd4ac8a9c51b7cf337807c4881ed163515dc56e61fd818",
|
|
23
|
+
"workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
|
|
24
24
|
"workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
|
|
25
25
|
"workflows/review.md": "aaeaf7ab4515e325084a77e75e18b325295f8d16799f71f8b7cd0ec67c52c0d6",
|
|
26
26
|
"workflows/run-audit.md": "e582f767967dc3fb6aaeb938ad1672e7bed18bf044055ce8c45c2114251b787a",
|
|
27
|
-
"workflows/spec-challenge.md": "
|
|
28
|
-
"workflows/specify.md": "
|
|
29
|
-
"workflows/verify.md": "
|
|
30
|
-
"hooks/definitions/
|
|
27
|
+
"workflows/spec-challenge.md": "dc99137c28c49a6f8312924709afb6077754d128e90466dc911150ce15737897",
|
|
28
|
+
"workflows/specify.md": "53b84e74871f6dbd93cae22a881cc5907e398b29501d0a1fa08c7ed69df705cb",
|
|
29
|
+
"workflows/verify.md": "45f9c189520dfe9d24c0bc340a15e6a80c988fca1b84dc187627032a6dbaee16",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml": "a10dc927418bc130b447eb33faf0f45669ecd9c7917f56947ddd74850a4e0e37",
|
|
31
|
+
"hooks/definitions/loop_cap_guard.yaml": "f0fd220e028ab6fad3d8fd650602884fe500ca4899eff6e428cf217af058618d",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
|
|
35
36
|
"hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
|
|
38
|
+
"hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
"workflows/spec-challenge.md",
|
|
28
28
|
"workflows/specify.md",
|
|
29
29
|
"workflows/verify.md",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml",
|
|
30
31
|
"hooks/definitions/loop_cap_guard.yaml",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml",
|
|
35
36
|
"hooks/definitions/session_start.yaml",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml",
|
|
38
|
+
"hooks/hooks.json"
|
|
37
39
|
],
|
|
38
40
|
"files": [
|
|
39
41
|
".cursor/hooks.json",
|
|
@@ -6,7 +6,7 @@ This host package is generated from the canonical Wazir sources.
|
|
|
6
6
|
|
|
7
7
|
- project: Wazir
|
|
8
8
|
- hosts: claude, codex, gemini, cursor
|
|
9
|
-
- phases:
|
|
9
|
+
- phases: init, clarifier, executor, final_review
|
|
10
10
|
- roles: clarifier, researcher, specifier, content-author, designer, planner, executor, verifier, reviewer, learner
|
|
11
11
|
- protected paths: input, roles, workflows, schemas, exports/hosts
|
|
12
12
|
- state root default: ~/.wazir/projects/{project_slug}
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"host": "gemini",
|
|
3
3
|
"source_hashes": {
|
|
4
|
-
"wazir.manifest.yaml": "
|
|
5
|
-
"roles/clarifier.md": "
|
|
4
|
+
"wazir.manifest.yaml": "f00776eb08ed3332b8f855001a2fd0b866cd0b81d009c6fbb316149c398c51ca",
|
|
5
|
+
"roles/clarifier.md": "1e1b8a2c05f1070fdcef485963cfcbffff62c4b2703a8d73fe51ac52d056e573",
|
|
6
6
|
"roles/content-author.md": "cc20b80bd70ab68b3239a9cf56bf1ffc2c06843d38afc6b190844b35a1d73c3e",
|
|
7
|
-
"roles/designer.md": "
|
|
8
|
-
"roles/executor.md": "
|
|
7
|
+
"roles/designer.md": "76cff5bda82975cfb4074de71681e7c8ba284e2e49d0cc98f90208642fef74fc",
|
|
8
|
+
"roles/executor.md": "874625f62fb4bcce70c3d1554152e0e2cd3345cfe34220eec9fa0027b19c750c",
|
|
9
9
|
"roles/learner.md": "4a7e4635c0fbd2def794f017ca6ef5d47b6ea8dfaa5e85eeeecece61256f21a1",
|
|
10
|
-
"roles/planner.md": "
|
|
11
|
-
"roles/researcher.md": "
|
|
12
|
-
"roles/reviewer.md": "
|
|
13
|
-
"roles/specifier.md": "
|
|
10
|
+
"roles/planner.md": "07ef01bf1d4a1addda2172381013087f69aa91b4b239320ee253640d6db618cb",
|
|
11
|
+
"roles/researcher.md": "b2b9e9d79d7b8194603ae3d22d9f8cc994d60384e8de1b4c6b6559410523e0b9",
|
|
12
|
+
"roles/reviewer.md": "dd97b74152b5bd0472987d6e4660d693ebe75d5c067e17df4725f897156d014e",
|
|
13
|
+
"roles/specifier.md": "2d4cd45380fc6c68c7e05117165ae28853237cdffc58e712a5ebd7c1ce69b76e",
|
|
14
14
|
"roles/verifier.md": "ce8e200439190643a02ffe31f72e4b4ec319ccff9f0841cc3138eb517af5fed3",
|
|
15
15
|
"workflows/author.md": "81844443743540b21dd990fa93e59d8898216e498acde920e7007f8b81cef107",
|
|
16
|
-
"workflows/clarify.md": "
|
|
17
|
-
"workflows/design-review.md": "
|
|
18
|
-
"workflows/design.md": "
|
|
19
|
-
"workflows/discover.md": "
|
|
20
|
-
"workflows/execute.md": "
|
|
16
|
+
"workflows/clarify.md": "6db1bc65a61e3227649ed65f15de9a88500ea4239b388918c82d474ef92f0030",
|
|
17
|
+
"workflows/design-review.md": "96e454283af28f02a4d7b03f4edfa5c00d02107fcfa3d0c8f19e640f56027845",
|
|
18
|
+
"workflows/design.md": "7f69758b22f88c12d16846ac1dd444f4e178ab116559ef9f2f26f6daa1a10d62",
|
|
19
|
+
"workflows/discover.md": "0696add486f739a46ed4c2b71b67bdda3ab9fea2d1395e662191282529ed21d2",
|
|
20
|
+
"workflows/execute.md": "33428704476877b2c8cf34c6eda3a56d1fd71e8bbea0f05c122bb3da2c6475a6",
|
|
21
21
|
"workflows/learn.md": "9b1955a00eb0ea47af08a3639c3cbc2f15b8eab6cc02127e829bc8c83b0a52b5",
|
|
22
|
-
"workflows/plan-review.md": "
|
|
23
|
-
"workflows/plan.md": "
|
|
22
|
+
"workflows/plan-review.md": "8696c472cb4605a171fd4ac8a9c51b7cf337807c4881ed163515dc56e61fd818",
|
|
23
|
+
"workflows/plan.md": "fd52737159ab13688af8cbcb1c3fa224b1a9dda441b9ab337ab98cbfb5c68fa5",
|
|
24
24
|
"workflows/prepare-next.md": "8769b692be6d9fddf3b3f36fee6888159fb9fb2a5c31360cdbc9402e0f43fc27",
|
|
25
25
|
"workflows/review.md": "aaeaf7ab4515e325084a77e75e18b325295f8d16799f71f8b7cd0ec67c52c0d6",
|
|
26
26
|
"workflows/run-audit.md": "e582f767967dc3fb6aaeb938ad1672e7bed18bf044055ce8c45c2114251b787a",
|
|
27
|
-
"workflows/spec-challenge.md": "
|
|
28
|
-
"workflows/specify.md": "
|
|
29
|
-
"workflows/verify.md": "
|
|
30
|
-
"hooks/definitions/
|
|
27
|
+
"workflows/spec-challenge.md": "dc99137c28c49a6f8312924709afb6077754d128e90466dc911150ce15737897",
|
|
28
|
+
"workflows/specify.md": "53b84e74871f6dbd93cae22a881cc5907e398b29501d0a1fa08c7ed69df705cb",
|
|
29
|
+
"workflows/verify.md": "45f9c189520dfe9d24c0bc340a15e6a80c988fca1b84dc187627032a6dbaee16",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml": "a10dc927418bc130b447eb33faf0f45669ecd9c7917f56947ddd74850a4e0e37",
|
|
31
|
+
"hooks/definitions/loop_cap_guard.yaml": "f0fd220e028ab6fad3d8fd650602884fe500ca4899eff6e428cf217af058618d",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml": "a773cd6e18972dee8eef3b7cb06fd1d319a71de4588897cebfbe643f6781a3b2",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml": "daa0175d79f3e0127c5ce86a7a2f8df0be3f58b5c94fe749da715a17c7b2d04e",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml": "3c2663380ff3cd09f09de5b96bcf6123266fa74d8a03dfb2d6fbe40a43fb13cf",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml": "6683d41778b823e2a4e606065597569aa04363f091e135e165de9732f1fc2171",
|
|
35
36
|
"hooks/definitions/session_start.yaml": "9383fcf1f8304c87e57726478a461706c0fc73dc62bcc4d8661f2eeffa43a82d",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml": "67a3c0a8bb7cb66b88e77dc79e748082e964d278c47935662c453922a846482b",
|
|
38
|
+
"hooks/hooks.json": "f255345793951b5cf6f6d8c9a8b6a6ad2d3140023453410127a6f70d8e110c26"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
"workflows/spec-challenge.md",
|
|
28
28
|
"workflows/specify.md",
|
|
29
29
|
"workflows/verify.md",
|
|
30
|
+
"hooks/definitions/context_mode_router.yaml",
|
|
30
31
|
"hooks/definitions/loop_cap_guard.yaml",
|
|
31
32
|
"hooks/definitions/post_tool_capture.yaml",
|
|
32
33
|
"hooks/definitions/pre_compact_summary.yaml",
|
|
33
34
|
"hooks/definitions/pre_tool_capture_route.yaml",
|
|
34
35
|
"hooks/definitions/protected_path_write_guard.yaml",
|
|
35
36
|
"hooks/definitions/session_start.yaml",
|
|
36
|
-
"hooks/definitions/stop_handoff_harvest.yaml"
|
|
37
|
+
"hooks/definitions/stop_handoff_harvest.yaml",
|
|
38
|
+
"hooks/hooks.json"
|
|
37
39
|
],
|
|
38
40
|
"files": [
|
|
39
41
|
"GEMINI.md"
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join, resolve, basename } from 'node:path';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const hooksDir = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const projectRoot = dirname(hooksDir);
|
|
10
|
+
const matrixPath = join(hooksDir, 'routing-matrix.json');
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Helpers
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
function loadRoutingMatrix() {
|
|
17
|
+
return JSON.parse(readFileSync(matrixPath, 'utf8'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function parseCommand(raw) {
|
|
21
|
+
return (raw || '').trim();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function firstToken(cmd) {
|
|
25
|
+
return cmd.split(/\s+/)[0] || '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function hasPipe(cmd) {
|
|
29
|
+
return /(?<![\\])\|/.test(cmd);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function hasRedirect(cmd) {
|
|
33
|
+
return /(?<![\\])[>]/.test(cmd);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Classification
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
function classify(cmd, matrix) {
|
|
41
|
+
// 1. Explicit context-mode marker always wins
|
|
42
|
+
if (cmd.includes('# wazir:context-mode')) return 'large';
|
|
43
|
+
|
|
44
|
+
// 2. Check large patterns FIRST — AC-3.1: large commands are never
|
|
45
|
+
// downgraded, even with a passthrough marker (AC-1.5).
|
|
46
|
+
for (const pattern of matrix.large) {
|
|
47
|
+
if (cmd === pattern || cmd.startsWith(pattern + ' ') || cmd.startsWith(pattern + '\t')) {
|
|
48
|
+
return 'large';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 3. Passthrough marker — restricted to heuristic false positives (AC-1.5).
|
|
53
|
+
// Only honoured when the command is NOT in the Large category (checked above).
|
|
54
|
+
if (cmd.includes('# wazir:passthrough')) return 'small';
|
|
55
|
+
|
|
56
|
+
// 4. Check small patterns
|
|
57
|
+
for (const pattern of matrix.small) {
|
|
58
|
+
if (cmd === pattern || cmd.startsWith(pattern + ' ') || cmd.startsWith(pattern + '\t')) {
|
|
59
|
+
return 'small';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 5. Ambiguous heuristics
|
|
64
|
+
const heuristic = matrix.ambiguous_heuristic || {};
|
|
65
|
+
|
|
66
|
+
if (heuristic.pipe_detected && hasPipe(cmd)) return 'ambiguous';
|
|
67
|
+
if (heuristic.redirect_detected && hasRedirect(cmd)) return 'ambiguous';
|
|
68
|
+
|
|
69
|
+
const bin = firstToken(cmd);
|
|
70
|
+
if (Array.isArray(heuristic.verbose_binaries) && heuristic.verbose_binaries.includes(bin)) {
|
|
71
|
+
return 'ambiguous';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Default: treat unknown commands as small (passthrough)
|
|
75
|
+
return 'small';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Context-mode enabled check
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
function isContextModeEnabled() {
|
|
83
|
+
// Check WAZIR_CONTEXT_MODE env var first
|
|
84
|
+
const envVal = process.env.WAZIR_CONTEXT_MODE;
|
|
85
|
+
if (envVal !== undefined) {
|
|
86
|
+
return envVal === '1' || envVal === 'true';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Fall back to manifest adapter setting
|
|
90
|
+
try {
|
|
91
|
+
const manifestPath = join(projectRoot, 'wazir.manifest.yaml');
|
|
92
|
+
const manifestText = readFileSync(manifestPath, 'utf8');
|
|
93
|
+
// Simple YAML parse for enabled_by_default under context_mode
|
|
94
|
+
const match = manifestText.match(/context_mode:[\s\S]*?enabled_by_default:\s*(true|false)/);
|
|
95
|
+
if (match) return match[1] === 'true';
|
|
96
|
+
} catch {
|
|
97
|
+
// ignore
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// One-per-session warning when context-mode is disabled
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
const SESSION_WARNING_KEY = 'WAZIR_CM_WARNED';
|
|
108
|
+
|
|
109
|
+
function emitDisabledWarning() {
|
|
110
|
+
if (process.env[SESSION_WARNING_KEY]) return;
|
|
111
|
+
|
|
112
|
+
process.stderr.write(
|
|
113
|
+
'[wazir:context-mode-router] context_mode adapter is disabled. ' +
|
|
114
|
+
'All commands pass through without routing. ' +
|
|
115
|
+
'Enable via WAZIR_CONTEXT_MODE=1 or set adapters.context_mode.enabled_by_default: true in manifest.\n',
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// Mark so downstream child processes see it (best-effort session dedup)
|
|
119
|
+
process.env[SESSION_WARNING_KEY] = '1';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
// Logging
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
function deriveStateRoot() {
|
|
127
|
+
if (process.env.WAZIR_STATE_ROOT) return process.env.WAZIR_STATE_ROOT;
|
|
128
|
+
try {
|
|
129
|
+
const manifestPath = join(projectRoot, 'wazir.manifest.yaml');
|
|
130
|
+
const raw = readFileSync(manifestPath, 'utf8');
|
|
131
|
+
const nameMatch = raw.match(/^\s+name:\s*(.+)$/m);
|
|
132
|
+
const templateMatch = raw.match(/state_root_default:\s*(.+)$/m);
|
|
133
|
+
if (nameMatch && templateMatch) {
|
|
134
|
+
const slug = nameMatch[1].trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'wazir-project';
|
|
135
|
+
const template = templateMatch[1].trim();
|
|
136
|
+
const expanded = template.startsWith('~/') ? join(homedir(), template.slice(2)) : template;
|
|
137
|
+
return resolve(expanded.replace('{project_slug}', slug));
|
|
138
|
+
}
|
|
139
|
+
} catch { /* fall through */ }
|
|
140
|
+
return join(homedir(), '.wazir', 'projects', '_default');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function logDecision(decision) {
|
|
144
|
+
const stateRoot = deriveStateRoot();
|
|
145
|
+
const logDir = join(stateRoot, 'logs');
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true });
|
|
149
|
+
const entry = JSON.stringify({
|
|
150
|
+
ts: new Date().toISOString(),
|
|
151
|
+
hook: 'context_mode_router',
|
|
152
|
+
...decision,
|
|
153
|
+
});
|
|
154
|
+
appendFileSync(join(logDir, 'routing.ndjson'), entry + '\n');
|
|
155
|
+
} catch {
|
|
156
|
+
// Logging is best-effort; never fail the hook over it
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Main
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const input = readFileSync(0, 'utf8');
|
|
166
|
+
const payload = input.trim() ? JSON.parse(input) : {};
|
|
167
|
+
const cmd = parseCommand(payload.command || payload.tool_input?.command || '');
|
|
168
|
+
const matrix = loadRoutingMatrix();
|
|
169
|
+
const category = classify(cmd, matrix);
|
|
170
|
+
const contextModeEnabled = isContextModeEnabled();
|
|
171
|
+
|
|
172
|
+
let route = 'passthrough';
|
|
173
|
+
|
|
174
|
+
if (!contextModeEnabled) {
|
|
175
|
+
emitDisabledWarning();
|
|
176
|
+
route = 'passthrough';
|
|
177
|
+
} else if (category === 'large' || category === 'ambiguous') {
|
|
178
|
+
route = 'context-mode';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const decision = { command: cmd, category, route, context_mode_enabled: contextModeEnabled };
|
|
182
|
+
|
|
183
|
+
logDecision(decision);
|
|
184
|
+
process.stdout.write(`${JSON.stringify({ routing_decision: decision })}\n`);
|
|
185
|
+
|
|
186
|
+
// Exit 0 = passthrough, non-zero = route to context-mode
|
|
187
|
+
process.exit(route === 'passthrough' ? 0 : 1);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
process.stderr.write(`${error.message}\n`);
|
|
190
|
+
process.exit(0); // failure_behavior.mode = warn → always allow on error
|
|
191
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
id: context_mode_router
|
|
2
|
+
trigger: context_mode_router
|
|
3
|
+
description: Route large command output through context-mode tools to avoid flooding model context.
|
|
4
|
+
input_contract:
|
|
5
|
+
required:
|
|
6
|
+
- command
|
|
7
|
+
allowed_side_effects:
|
|
8
|
+
- route_to_context_mode
|
|
9
|
+
output_contract:
|
|
10
|
+
produces:
|
|
11
|
+
- routing_decision
|
|
12
|
+
failure_behavior:
|
|
13
|
+
mode: warn
|
|
14
|
+
exit_code: 0
|
|
15
|
+
host_fallback:
|
|
16
|
+
claude: native_hook
|
|
17
|
+
codex: wrapper_command
|
|
18
|
+
gemini: wrapper_command
|
|
19
|
+
cursor: native_or_wrapper
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
id: loop_cap_guard
|
|
2
2
|
trigger: loop_cap_guard
|
|
3
|
-
description: Stop additional loop iterations after the configured phase cap is reached.
|
|
3
|
+
description: Stop additional loop iterations after the configured phase cap is reached. Canonical invocation path is `wazir capture loop-check`.
|
|
4
4
|
input_contract:
|
|
5
5
|
required:
|
|
6
6
|
- run_id
|