opencode-agent-skill 13.0.0-beta.0 → 13.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,11 +6,32 @@ The project follows Semantic Versioning.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [13.0.0-beta.2] - 2026-09-23
10
+
9
11
  ### Fixed
10
- - Routed all 11 `/ues-*` commands through the stable V2 `session.prompt` path using router-managed prompt aliases, avoiding `UnsupportedContentType` failures from the native `session.command` transport while preserving the same command templates and V1 native-command behavior.
12
+ - Routed all 11 `/ues-*` commands through the stable V2 `session.prompt` path using router-managed prompt aliases, avoiding `UnsupportedContentType` failures from the native `session.command` transport while preserving compatible command behavior.
11
13
  - Prevented `/ues-run` from duplicating the full `$ARGUMENTS` payload inside its task-policy example, reducing long-prompt amplification.
12
14
  - Fixed OpenCode V2 local router loading on clean global configs by removing the unnecessary bare `@opencode/plugin` runtime import; `ues-router` now exports the plain `{ id, setup }` definition accepted by the V2 loader.
13
15
  - Prevented OpenCode V2 UES router subprocesses (`where`, `ocskill`, Node shim execution and Git probes) from flashing transient CMD windows on Windows by routing them through a hidden-window spawn wrapper.
16
+ - Changed `/ues-run` from an unconditional long-horizon declaration into adaptive FAST / STANDARD / DEEP admission driven by the actual user request and task policy.
17
+ - Removed the synthetic `Explicit long-horizon engineering request.` policy input for `/ues-run`; only `/ues-resume` retains explicit durable-resume semantics.
18
+ - Added compact FAST and STANDARD V2 prompt envelopes so trivial or bounded work does not inherit `.ues-work`, plan-gate, subagent-dispatch and integration-gate overhead.
19
+ - Kept a conservative fallback: when policy classification is unavailable, the full command contract is preserved instead of weakening verification.
20
+
21
+ ### Regression coverage
22
+ - Added V13 tests proving that `/ues-run Chỉ trả lời đúng một từ: OK` stays FAST, bounded fixes stay STANDARD, whole-repository work escalates to DEEP, and `/ues-resume` remains long-horizon.
23
+ - Added a contract test ensuring the bundled `/ues-run` template itself is adaptive rather than declaring every invocation long-horizon.
24
+
25
+ ## [13.0.0-beta.1] - 2026-09-23
26
+
27
+ ### Fixed
28
+ - Hardened V2 prompt aliases for ChatGPT-style pasted prompts: BOM/zero-width prefixes and whole-prompt markdown fences are normalized before alias detection.
29
+ - Bounded the text sent to `ocskill task-policy` so very large pasted prompts no longer risk Windows command-line length failures; the full user prompt still goes to the model while only a bounded head/tail classification view goes through the CLI.
30
+ - Routed skill classification from the actual user request instead of the expanded command template, reducing template-induced over-routing on long prompts.
31
+ - Kept installer result shape stable with `promptAliases: []` on foreign-state refusal.
32
+
33
+ ### Regression coverage
34
+ - Added fenced-paste, BOM, 70k-character policy-input and oversized multiline `/ues-run` regression tests.
14
35
 
15
36
  ## [13.0.0-beta.0] - 2026-09-22
16
37
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # OpenCode Universal Engineering System (UES)
2
2
 
3
- > **V13 beta: 13.0.0-beta.0** — parallel weak-model runtime với same-model worker pool, event-driven DAG, transactional worktree integration và hardened CLI/Windows runtime.
4
- > **Stable latest vẫn là V11: 11.0.0.** V13 được đóng gói dưới prerelease `13.0.0-beta.0`; npm prerelease dùng dist-tag `next`, còn `latest` tiếp tục giữ V11 cho đến khi V13 được promote stable.
3
+ > **V13 beta: 13.0.0-beta.2** — parallel weak-model runtime với same-model worker pool, event-driven DAG, transactional worktree integration và hardened CLI/Windows runtime.
4
+ > **Stable latest vẫn là V11: 11.0.0.** V13 được đóng gói dưới prerelease `13.0.0-beta.2`; npm prerelease dùng dist-tag `next`, còn `latest` tiếp tục giữ V11 cho đến khi V13 được promote stable.
5
5
 
6
6
  [![npm version](https://img.shields.io/npm/v/opencode-agent-skill.svg)](https://www.npmjs.com/package/opencode-agent-skill)
7
7
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
@@ -49,16 +49,18 @@ Parallel resume không còn yêu cầu root phải sạch tuyệt đối. Nếu
49
49
 
50
50
  > **Compatibility:** V13 CLI/durable-state/verification hardening vẫn dùng được trên OpenCode 1.x. Native `ues.dispatch_task` / `ues.dispatch_parallel` cần router plugin và fresh-session APIs của OpenCode V2; nếu capability không đủ, runtime fail closed thay vì giả vờ chạy song song.
51
51
 
52
- ### V13 beta validation hiện tại
52
+ ### V13 beta validation gate
53
53
 
54
- Bản đóng gói hiện tại đã được kiểm tra local trên Windows 10 với OpenCode V2.0.15:
54
+ Mỗi V13 prerelease, bao gồm beta.2, chỉ được publish sau khi full gate hiện tại PASS. Không hard-code số lượng test vào tài liệu này vì suite tiếp tục tăng; nguồn đúng là output của chính các lệnh gate:
55
+
56
+ - `npm run evals:v13`;
57
+ - `npm test`;
58
+ - `npm run ci`;
59
+ - `npm pack --dry-run`;
60
+ - packed-install smoke và plain-install smoke;
61
+ - live OpenCode V2 check: router load, `/ues-run` FAST/STANDARD/DEEP admission, prompt dài, MCP/provider path và restart trên session mới;
62
+ - npm 11+ có thể chặn lifecycle script theo `allowScripts`; `ocskill install` vẫn là resource-sync fallback chính thức.
55
63
 
56
- - `npm run evals:v13`: **36/36 PASS**;
57
- - `npm test`: **298 tests**, **296 pass**, **0 fail**, **2 platform-specific skip**;
58
- - managed `ues-router` load thành công dưới `~/.config/opencode/plugins/ues-router`;
59
- - router không còn phụ thuộc runtime bare import `@opencode/plugin`, nên clean global OpenCode config vẫn load được;
60
- - các subprocess nội bộ của router (`where`, `ocskill`, Node shim và Git probes) dùng hidden-window spawn trên Windows để tránh cửa sổ CMD nháy liên tục;
61
- - npm 11+ vẫn có thể chặn lifecycle script theo `allowScripts`; `ocskill install` là resource-sync fallback chính thức.
62
64
 
63
65
  ---
64
66
 
@@ -819,7 +821,7 @@ npm install -g opencode-agent-skill
819
821
  Phiên bản hiện tại:
820
822
 
821
823
  ```text
822
- 13.0.0-beta.0
824
+ 13.0.0-beta.2
823
825
  ```
824
826
 
825
827
  V13 beta dùng npm dist-tag `next`; `latest` tiếp tục trỏ tới V11 stable cho đến khi các release gate V13 hoàn tất.
@@ -835,7 +837,7 @@ npm pack
835
837
  Trước khi publish, kiểm tra version chưa tồn tại trên registry:
836
838
 
837
839
  ```cmd
838
- npm view opencode-agent-skill@13.0.0-beta.0 version --registry=https://registry.npmjs.org/
840
+ npm view opencode-agent-skill@13.0.0-beta.2 version --registry=https://registry.npmjs.org/
839
841
  ```
840
842
 
841
843
  Nếu version chưa tồn tại, prerelease được publish với dist-tag `next`.
@@ -27,7 +27,7 @@ Use:
27
27
 
28
28
  ```cmd
29
29
  npm pack
30
- npm install -g .\opencode-agent-skill-13.0.0-beta.0.tgz --allow-scripts=opencode-agent-skill
30
+ npm install -g .\opencode-agent-skill-13.0.0-beta.1.tgz --allow-scripts=opencode-agent-skill
31
31
  ocskill install
32
32
  ocskill status
33
33
  ocskill doctor
@@ -42,7 +42,7 @@ For routine development, the automated `smoke:pack` test uses an isolated npm pr
42
42
  Before publishing, verify the exact prerelease version is not already present:
43
43
 
44
44
  ```cmd
45
- npm view opencode-agent-skill@13.0.0-beta.0 version --registry=https://registry.npmjs.org/
45
+ npm view opencode-agent-skill@13.0.0-beta.1 version --registry=https://registry.npmjs.org/
46
46
  ```
47
47
 
48
48
  If it is not present, a manual prerelease publish uses `next`, not `latest`:
@@ -58,7 +58,7 @@ After publication verify:
58
58
 
59
59
  ```cmd
60
60
  npm view opencode-agent-skill versions --json
61
- npm view opencode-agent-skill@13.0.0-beta.0 version
61
+ npm view opencode-agent-skill@13.0.0-beta.1 version
62
62
  npm dist-tag ls opencode-agent-skill
63
63
  ```
64
64
 
@@ -66,7 +66,7 @@ For V13 beta the expected dist-tags are:
66
66
 
67
67
  ```text
68
68
  latest: 11.0.0
69
- next: 13.0.0-beta.0
69
+ next: 13.0.0-beta.1
70
70
  ```
71
71
 
72
72
  Do not move `latest` to V13 until the prerelease is intentionally promoted stable.
@@ -85,7 +85,7 @@ Workflow: publish.yml
85
85
 
86
86
  Then the GitHub-hosted workflow can authenticate through OIDC instead of a long-lived npm publish token. npm Trusted Publishing requires the corresponding publisher relationship to be configured on npm; repository code alone cannot create that account-side trust relationship.
87
87
 
88
- The current `publish.yml` is tag-only. A matching prerelease tag such as `v13.0.0-beta.0` runs the full package gate and publishes with npm dist-tag `next`; a stable version publishes to `latest`. The workflow first checks whether that exact version already exists and skips duplicate publication.
88
+ The current `publish.yml` is tag-only. A matching prerelease tag such as `v13.0.0-beta.1` runs the full package gate and publishes with npm dist-tag `next`; a stable version publishes to `latest`. The workflow first checks whether that exact version already exists and skips duplicate publication.
89
89
 
90
90
  ## Release checklist
91
91
 
@@ -42,6 +42,8 @@ UES converts managed agent permission frontmatter to V2 ordered `permissions` an
42
42
 
43
43
  V13 also installs the 11 UES slash-command templates inside the managed router as V2 **prompt aliases** instead of registering them as native global custom commands. Typing `/ues-run ...`, `/ues-fix ...`, and the other `/ues-*` aliases therefore travels through `session.prompt`; the router expands the same bundled command contract before routing skills. This is a compatibility workaround for V2 custom-command transport failures such as `UnsupportedContentType` from the `session.command` path. Re-syncing with `ocskill install` removes stale UES-managed native command files from older installs.
44
44
 
45
+ For `/ues-run`, V13.0.0-beta.2 adds adaptive admission before the prompt is sent to the model. The router classifies the real user arguments, not the expanded command template. FAST and STANDARD work receive compact envelopes, while only DEEP/long-horizon/high-risk work keeps the full durable workflow. `/ues-resume` stays explicitly durable. This prevents a trivial or bounded request from being turned into a long-running repository workflow simply because the user typed `/ues-run`.
46
+
45
47
  The plugin provides:
46
48
 
47
49
  - prompt-admission skill routing
@@ -1,6 +1,6 @@
1
1
  # V13 Parallel Weak-Model Runtime
2
2
 
3
- Status: beta prerelease (`13.0.0-beta.0`).
3
+ Status: beta prerelease (`13.0.0-beta.2`).
4
4
 
5
5
  ## Goal
6
6
 
@@ -38,6 +38,17 @@ V13 keeps CLI, durable state, receipts, task graphs and Windows text hardening a
38
38
 
39
39
  When npm blocks lifecycle scripts (common with stricter npm 11+ `allowScripts` policy), install still leaves the CLI available; run `ocskill install` to perform the documented resource sync explicitly.
40
40
 
41
+ ### Adaptive /ues-run admission on OpenCode V2
42
+
43
+ V2 prompt aliases classify the **actual alias arguments** before choosing the prompt envelope. `/ues-run` no longer forces long-horizon mode merely because the alias was used:
44
+
45
+ - FAST requests receive a compact prompt that preserves the exact user outcome and skips durable planning unless repository work is actually required.
46
+ - STANDARD requests use targeted repository evidence, bounded edits and affected verification without creating durable state by default.
47
+ - DEEP / long-horizon / high-risk requests retain the full durable `.ues-work/<slug>/`, plan-gate, fresh-verifier and integration-gate contract.
48
+ - `/ues-resume` remains explicitly durable so an existing long-running workspace is not accidentally downgraded.
49
+
50
+ If policy classification is unavailable, the router fails conservatively by preserving the full command contract rather than silently weakening verification.
51
+
41
52
  ## CLI hardening
42
53
 
43
54
  V13 parses `--help` before positional arguments, so commands such as these are safe:
@@ -1,35 +1,42 @@
1
1
  ---
2
- description: Execute complex/long-running engineering work with adaptive policy, crash-safe leases, structured evidence, context manifests, isolated sandboxes and integration gates.
2
+ description: Execute engineering work with adaptive UES policy, escalating to durable long-horizon state only when risk, scope or evidence requires it.
3
3
  agent: build
4
4
  ---
5
5
 
6
- Run this task using the UES long-horizon workflow: $ARGUMENTS
6
+ Run this task using the UES adaptive workflow: $ARGUMENTS
7
7
 
8
- Treat this command as permission to create a repository-local, git-ignored `.ues-work/<slug>/` execution workspace for durable non-secret planning state.
8
+ Preserve the user's exact requested outcome, response constraints and approval boundaries. `/ues-run` means "use UES when useful"; it does not by itself declare the task long-horizon.
9
9
 
10
- Never create or use `ues-work/` (without the leading dot) as durable UES state. If such a directory exists from an older/manual run, treat it as ordinary repository content unless the user explicitly asks to migrate it; official state must come from `ocskill work init` under `.ues-work/<slug>/`.
10
+ Adaptive admission:
11
+ 1. If the request is directly answerable and requires no repository evidence, edits or machine-checkable verification, answer it directly and stop. Do not inspect the repository, create `.ues-work`, create SPEC/PLAN files, dispatch subagents or run unrelated commands.
12
+ 2. Otherwise classify only a concise task summary with `ocskill task-policy "<concise task summary>"`. Never duplicate the full user prompt into shell arguments.
13
+ 3. Follow the returned execution policy instead of forcing one workflow:
14
+ - FAST / inline: use only the minimum direct evidence required by the request. Do not initialize durable state or plan/integration gates. Make bounded changes if needed and run targeted verification.
15
+ - STANDARD: inspect targeted repository evidence, keep the working plan concise, make bounded edits and run targeted + affected verification. Durable `.ues-work` state, plan gates and parallel dispatch are not required by default.
16
+ - DEEP / long-horizon / high-risk: use the durable workflow below. This includes cases where the policy reports durable state, a required plan check, long-horizon mode or high risk.
17
+ 4. Escalate only from the actual request, policy result or new evidence. Never escalate merely because the alias is `/ues-run`.
11
18
 
12
- Required workflow:
13
- 1. Classify the request with `ocskill task-policy "<concise task summary>"`. Do not duplicate the full user prompt into shell arguments; use the returned risk/mode/context guidance rather than assuming every non-trivial task needs the same workflow.
14
- 2. Inspect repository instructions and deterministic evidence with `ocskill inspect`, `ocskill repo-graph . --compact`, and targeted impact searches. Expand to the full graph only when exact edge detail is needed.
15
- 3. Create a concise SPEC with observable acceptance criteria.
16
- 4. Initialize persistent state with `ocskill work init`.
17
- 5. Produce a file-aware `PLAN.json` using the UES plan schema, then import it with `ocskill work plan`.
18
- 6. Dispatch `ues-plan-checker` in fresh context. For long/high-risk work, bind the PASS to the current plan with a structured receipt, then approve it:
19
+ Durable workflow for DEEP / long-horizon / high-risk work:
20
+ 1. Inspect repository instructions and deterministic evidence with `ocskill inspect`, `ocskill repo-graph . --compact`, and targeted impact searches. Expand to the full graph only when exact edge detail is needed.
21
+ 2. Create a concise SPEC with observable acceptance criteria.
22
+ 3. Initialize persistent state with `ocskill work init`.
23
+ 4. Produce a file-aware `PLAN.json` using the UES plan schema, then import it with `ocskill work plan`.
24
+ 5. Dispatch `ues-plan-checker` in fresh context. For long/high-risk work, bind the PASS to the current plan with a structured receipt, then approve it:
19
25
  `ocskill work gate-receipt <slug> plan . --verifier ues-plan-checker --evidence "<summary>" --out .ues-work/<slug>/reports/plan-receipt.json`
20
26
  followed by `ocskill work approve-plan <slug> . --evidence "<summary>" --receipt-file .ues-work/<slug>/reports/plan-receipt.json`.
21
- 7. Use `ocskill task-graph` and execute only dependency-ready tasks. On OpenCode V2, when two or more independent tasks are ready, prefer `ues.dispatch_parallel`. V13 uses multiple fresh sessions of one shared model, not multiple model families. For a single task or a deliberately serial path, use `ues.dispatch_task`.
22
- 8. `ues.dispatch_parallel` is event-driven rather than wave-barrier driven: as soon as a task is independently verified, transactionally integrated and durably completed, newly unblocked dependencies may start in the next free worker slot. Resource leases serialize overlapping writers, unknown scopes and shared configuration surfaces.
23
- 9. Each parallel writer gets an isolated Git worktree. A pre-existing dirty root is treated as an inherited baseline, and downstream worktrees also inherit already integrated root changes through an internal sandbox snapshot; only task-local deltas are integrated and the user's root branch is not auto-committed. Integration is serialized and rolled back if post-integration verification/receipt/completion fails.
24
- 10. For machine-checkable verification, add `verificationCommands` to the approved task, for example `{"command":"node","args":["--test","test/foo.test.mjs"]}`. V13 runs these exact commands after integration via `ocskill work verify-command`, records deterministic receipts, then also records the fresh independent verifier verdict. For long/high-risk plans, current-fingerprint receipt evidence remains mandatory.
25
- 11. During long execution keep task leases alive (the V2 dispatcher does this automatically). On resume, `ocskill work recover` or `ocskill work resume` recovers expired leases instead of leaving tasks stuck in `running`. In parallel mode, keep one shared model for all worker/verifier sessions unless the user explicitly changes the run design.
26
- 12. After all tasks complete, dispatch `ues-integration-verifier`. For PASS on long/high-risk work, create an integration receipt bound to the current workspace fingerprint:
27
+ 6. Use `ocskill task-graph` and execute only dependency-ready tasks. On OpenCode V2, when two or more independent tasks are ready, prefer `ues.dispatch_parallel`. V13 uses multiple fresh sessions of one shared model, not multiple model families. For a single task or a deliberately serial path, use `ues.dispatch_task`.
28
+ 7. `ues.dispatch_parallel` is event-driven rather than wave-barrier driven: as soon as a task is independently verified, transactionally integrated and durably completed, newly unblocked dependencies may start in the next free worker slot. Resource leases serialize overlapping writers, unknown scopes and shared configuration surfaces.
29
+ 8. Each parallel writer gets an isolated Git worktree. A pre-existing dirty root is treated as an inherited baseline, and downstream worktrees also inherit already integrated root changes through an internal sandbox snapshot; only task-local deltas are integrated and the user's root branch is not auto-committed. Integration is serialized and rolled back if post-integration verification/receipt/completion fails.
30
+ 9. For machine-checkable verification, add `verificationCommands` to the approved task, for example `{"command":"node","args":["--test","test/foo.test.mjs"]}`. V13 runs these exact commands after integration via `ocskill work verify-command`, records deterministic receipts, then also records the fresh independent verifier verdict. For long/high-risk plans, current-fingerprint receipt evidence remains mandatory.
31
+ 10. During long execution keep task leases alive (the V2 dispatcher does this automatically). On resume, `ocskill work recover` or `ocskill work resume` recovers expired leases instead of leaving tasks stuck in `running`. In parallel mode, keep one shared model for all worker/verifier sessions unless the user explicitly changes the run design.
32
+ 11. After all tasks complete, dispatch `ues-integration-verifier`. For PASS on long/high-risk work, create an integration receipt bound to the current workspace fingerprint:
27
33
  `ocskill work gate-receipt <slug> integration . --verifier ues-integration-verifier --verdict PASS --evidence "<summary>" --out .ues-work/<slug>/reports/integration-receipt.json`
28
34
  then record it with `ocskill work verify-integration <slug> . --verdict PASS --evidence "<summary>" --receipt-file .ues-work/<slug>/reports/integration-receipt.json`.
29
- 13. `ocskill work finalize` is allowed only after a recorded PASS and only if the workspace fingerprint has not changed since that PASS. Re-run verification if it changed.
30
- 14. Inspect final diff/status and report only evidence-backed completion.
35
+ 12. `ocskill work finalize` is allowed only after a recorded PASS and only if the workspace fingerprint has not changed since that PASS. Re-run verification if it changed.
36
+ 13. Inspect final diff/status and report only evidence-backed completion.
31
37
 
32
- Do not merge, push, publish, deploy or perform destructive operations without explicit user approval.
38
+ Never create or use `ues-work/` (without the leading dot) as durable UES state. If such a directory exists from an older/manual run, treat it as ordinary repository content unless the user explicitly asks to migrate it; official durable state must come from `ocskill work init` under `.ues-work/<slug>/`.
33
39
 
40
+ Do not merge, push, publish, deploy or perform destructive operations without explicit user approval.
34
41
 
35
42
  After a meaningful eval run, `ocskill learn analyze . --eval-dir .ues-evals` clusters recurring failures into candidate lessons. `ocskill learn accept <id> .` stages a proposal, but shadow-required lessons enter future context only after `ocskill learn promote <id> . --baseline <rate> --candidate <rate> --samples N` proves an improvement.
@@ -17,6 +17,92 @@ export const UES_PROMPT_ALIASES = Object.freeze([
17
17
 
18
18
  const ALIAS_SET = new Set(UES_PROMPT_ALIASES)
19
19
 
20
+ export function normalizeUesPromptPaste(text) {
21
+ let value = String(text || "")
22
+ .replace(/^\uFEFF/, "")
23
+ .replace(/^[\u200B-\u200D]+/, "")
24
+
25
+ const trimmed = value.trim()
26
+ const fenced = trimmed.match(/^\`\`\`(?:text|txt|md|markdown|prompt|plaintext)?[ \t]*\r?\n([\s\S]*?)\r?\n\`\`\`\s*$/i)
27
+ if (fenced) value = fenced[1]
28
+
29
+ return value
30
+ }
31
+
32
+ export function policySourceForPromptAlias(promptAlias, promptText) {
33
+ if (!promptAlias) return normalizeUesPromptPaste(promptText).trim()
34
+
35
+ const args = String(promptAlias.arguments || "").trim()
36
+ if (promptAlias.alias === "ues-resume") {
37
+ return [
38
+ "Resume an existing durable UES execution.",
39
+ args,
40
+ ].filter(Boolean).join("\n")
41
+ }
42
+
43
+ return args || `/${promptAlias.alias}`
44
+ }
45
+
46
+ export function promptAliasTextForPolicy(promptAlias, policy) {
47
+ if (!promptAlias) return null
48
+ if (promptAlias.alias !== "ues-run") return promptAlias.text
49
+
50
+ const args = String(promptAlias.arguments || "").trim()
51
+ const mode = String(policy?.mode || "").toLowerCase()
52
+ const risk = String(policy?.risk || "").toLowerCase()
53
+ const profile = String(policy?.executionProfile || policy?.profile?.name || "").toLowerCase()
54
+ const isDeep = mode === "long-horizon" || risk === "high" || profile === "deep"
55
+ const isFast = !isDeep && (profile === "fast" || mode === "inline")
56
+ const isStandard = !isDeep && (profile === "standard" || mode === "standard")
57
+
58
+ if (isFast) {
59
+ return [
60
+ "UES V2 prompt alias: /ues-run. Adaptive policy selected FAST from the actual user request.",
61
+ "Preserve the user's exact requested outcome and response constraints.",
62
+ "Do not initialize .ues-work, create SPEC/PLAN state, inspect the repository, dispatch subagents, or run verification unless the request itself requires repository work or machine-checkable evidence.",
63
+ "If the request is directly answerable, answer it directly now.",
64
+ "",
65
+ "User request:",
66
+ args,
67
+ ].join("\n").trim()
68
+ }
69
+
70
+ if (isStandard) {
71
+ return [
72
+ "UES V2 prompt alias: /ues-run. Adaptive policy selected STANDARD from the actual user request.",
73
+ "Preserve the user's exact requested outcome and approval boundaries.",
74
+ "Use targeted repository evidence, bounded edits, and targeted + affected verification.",
75
+ "Do not create durable .ues-work state, plan gates, integration gates, or parallel workers unless new evidence justifies reclassification to DEEP/high-risk.",
76
+ "If evidence materially widens scope or risk, re-run ocskill task-policy on a concise updated summary before escalating.",
77
+ "",
78
+ "User request:",
79
+ args,
80
+ ].join("\n").trim()
81
+ }
82
+
83
+ return promptAlias.text
84
+ }
85
+
86
+ export function policyPromptForCli(text, maxChars = 12_000) {
87
+ const raw = normalizeUesPromptPaste(text).trim()
88
+ const limit = Math.max(2_000, Number(maxChars) || 12_000)
89
+ if (raw.length <= limit) {
90
+ return { text: raw, truncated: false, originalChars: raw.length, cliChars: raw.length }
91
+ }
92
+
93
+ const marker = "\n\n[UES_POLICY_INPUT_TRUNCATED_FOR_CLI]\n\n"
94
+ const usable = Math.max(1, limit - marker.length)
95
+ const headChars = Math.floor(usable * 0.72)
96
+ const tailChars = usable - headChars
97
+ const bounded = raw.slice(0, headChars) + marker + raw.slice(-tailChars)
98
+ return {
99
+ text: bounded,
100
+ truncated: true,
101
+ originalChars: raw.length,
102
+ cliChars: bounded.length,
103
+ }
104
+ }
105
+
20
106
  function parseFrontmatter(source) {
21
107
  const text = String(source || "")
22
108
  if (!text.startsWith("---")) return { metadata: {}, body: text }
@@ -44,7 +130,7 @@ function splitArgs(input) {
44
130
  }
45
131
 
46
132
  export function expandUesPromptAlias(text, templateDir) {
47
- const raw = String(text || "")
133
+ const raw = normalizeUesPromptPaste(text)
48
134
  const match = raw.match(/^\s*\/(ues-[a-z0-9]+(?:-[a-z0-9]+)*)(?:\s+([\s\S]*?))?\s*$/i)
49
135
  if (!match) return null
50
136
 
@@ -8,7 +8,12 @@ import { runtimeCapabilities } from "./capabilities.js"
8
8
  import { parallelRootBaseline, runEventDrivenDAG } from "./parallel-runtime.js"
9
9
  import { readProjectJson, readProjectText } from "./text-runtime.js"
10
10
  import { extractVerifierVerdict } from "./verifier-runtime.js"
11
- import { expandUesPromptAlias } from "./command-runtime.js"
11
+ import {
12
+ expandUesPromptAlias,
13
+ policyPromptForCli,
14
+ policySourceForPromptAlias,
15
+ promptAliasTextForPolicy,
16
+ } from "./command-runtime.js"
12
17
  import {
13
18
  budgetToolResult,
14
19
  classifyProviderFailure,
@@ -1538,9 +1543,20 @@ export default {
1538
1543
  const config = routerConfig()
1539
1544
  if (!config.enabled) return
1540
1545
 
1541
- const promptAlias = expandUesPromptAlias(event.prompt?.text, COMMAND_TEMPLATE_DIR)
1546
+ const originalPromptText = String(event.prompt?.text || "")
1547
+ const promptAlias = expandUesPromptAlias(originalPromptText, COMMAND_TEMPLATE_DIR)
1548
+ const routingText = promptAlias
1549
+ ? (promptAlias.arguments || `/${promptAlias.alias}`)
1550
+ : originalPromptText
1551
+ const policySource = policySourceForPromptAlias(promptAlias, originalPromptText)
1552
+ const policyInput = policyPromptForCli(policySource)
1553
+ let policy = null
1554
+ try {
1555
+ policy = runOcskillJSON(["task-policy", policyInput.text], projectRoot)
1556
+ } catch {}
1557
+
1542
1558
  if (promptAlias && event.prompt) {
1543
- event.prompt.text = promptAlias.text
1559
+ event.prompt.text = promptAliasTextForPolicy(promptAlias, policy)
1544
1560
  event.metadata = {
1545
1561
  ...event.metadata,
1546
1562
  uesPromptAlias: {
@@ -1548,22 +1564,19 @@ export default {
1548
1564
  sourceName: promptAlias.sourceName,
1549
1565
  preferredAgent: promptAlias.agent,
1550
1566
  transport: "session.prompt",
1567
+ adaptiveProfile: policy?.executionProfile || policy?.profile?.name || null,
1551
1568
  },
1552
1569
  }
1553
1570
  }
1554
1571
 
1555
- const promptText = String(event.prompt?.text || "")
1556
- let policy = null
1557
- try {
1558
- policy = runOcskillJSON(["task-policy", promptText], projectRoot)
1559
- } catch {}
1560
- const intent = classifyIntent(promptText, routingFacts)
1572
+ const promptText = String(event.prompt?.text || originalPromptText)
1573
+ const intent = classifyIntent(routingText, routingFacts)
1561
1574
  const effectiveMaxSkills = Math.max(
1562
1575
  1,
1563
1576
  Math.min(config.maxSkills, Number(policy?.maxSkills || config.maxSkills)),
1564
1577
  )
1565
1578
  const selected = []
1566
- for (const id of [...routeSkillsForPolicy(promptText, policy, effectiveMaxSkills, routingFacts), ...policySkills(policy)]) {
1579
+ for (const id of [...routeSkillsForPolicy(routingText, policy, effectiveMaxSkills, routingFacts), ...policySkills(policy)]) {
1567
1580
  if (!selected.includes(id)) selected.push(id)
1568
1581
  if (selected.length >= effectiveMaxSkills) break
1569
1582
  }
@@ -1587,6 +1600,11 @@ export default {
1587
1600
  feedbackDomains: routingFacts.feedbackDomains,
1588
1601
  acceptedLearningCount: routingFacts.acceptedLearningCount,
1589
1602
  },
1603
+ policyInput: {
1604
+ originalChars: policyInput.originalChars,
1605
+ cliChars: policyInput.cliChars,
1606
+ truncated: policyInput.truncated,
1607
+ },
1590
1608
  version: 13,
1591
1609
  effectiveMaxSkills,
1592
1610
  },
package/lib/installer.mjs CHANGED
@@ -340,6 +340,7 @@ export async function installResources(options = {}) {
340
340
  stateError: `State belongs to another package: ${previous.package}`,
341
341
  skills: [],
342
342
  commands: [],
343
+ promptAliases: [],
343
344
  agents: [],
344
345
  plugins: [],
345
346
  warnings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agent-skill",
3
- "version": "13.0.0-beta.0",
3
+ "version": "13.0.0-beta.2",
4
4
  "description": "Parallel weak-model engineering runtime with isolated same-model workers, event-driven DAG execution, transactional integration, adaptive context and evidence-gated verification for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {