@ngockhoale/ukit 2.6.11 → 2.7.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.
@@ -15,10 +15,37 @@ modelRoles:
15
15
  vision: unic-vision
16
16
 
17
17
  tools:
18
- approvalMode: write
18
+ # TASK-009 / SPEC FR-003: the unattended approval surface is pinned HERE —
19
+ # `approvalMode: yolo` plus all ten `tools.approval.*: allow`. The product
20
+ # source of truth is `orchestration.permissionMode: unattended`
21
+ # (.ukit/storage/config.json, written by TASK-008); this map is its omp-side
22
+ # rendering so installed projects run prompt-free out of the box.
23
+ # This SUPERSEDES the TASK-006/C34 omission decision (approvalMode left absent
24
+ # so the end user's global/runtime mode won): an interactive global would
25
+ # silently downgrade a shipped install to prompting, contradicting the
26
+ # unattended contract — the project-level pin is now required, not optional.
27
+ # `approvalMode: yolo` VERIFIED against omp v17.4.2 (2026-08-22) — same
28
+ # docContracts allowlist citation as compaction.thresholdTokens below.
29
+ # Safety under yolo is unchanged: the bash.patterns deny set below, the
30
+ # TASK-004 hook-bridge deny chain, and this approval map still gate dangerous
31
+ # ops — `allow` removes interactive prompts, not the deny checks.
32
+ # Residual risk: yolo + all-allow IS dangerously autonomous and is a
33
+ # deliberate, user-chosen posture (unattended mode). `eval` stays `allow`
34
+ # (was `prompt` pre-TASK-001): bash.patterns never covers the eval tool, but
35
+ # the TASK-004 bridge maps `eval` -> `Bash`, so every eval call is gated by
36
+ # the same block-dangerous chain as a bash command.
37
+ approvalMode: yolo
19
38
  approval:
20
39
  bash: allow
21
- eval: prompt
40
+ eval: allow
41
+ task: allow
42
+ read: allow
43
+ grep: allow
44
+ write: allow
45
+ edit: allow
46
+ lsp: allow
47
+ browser: allow
48
+ computer: allow
22
49
 
23
50
  bash:
24
51
  # Translated from templates/.claude/hooks/block-dangerous.sh's DANGEROUS_PATTERNS array.
@@ -27,8 +54,9 @@ bash:
27
54
  # catches it. `allow` only ever matches an ENTIRE, non-compound command, so the trailing "*"
28
55
  # allow is NOT a universal escape hatch: any compound command (`&&`, `;`, `|`) not itself caught
29
56
  # by a `deny`/`prompt` entry falls through to `tools.approvalMode` instead of being auto-allowed.
30
- # `bash.patterns` does not cover the `eval` tool at all — that is why `tools.approval.eval` above
31
- # is `prompt`, and why TASK-004's bridge separately maps `eval` -> `Bash`.
57
+ # `bash.patterns` does not cover the `eval` tool at all — that is why TASK-004's bridge
58
+ # separately maps `eval` -> `Bash`, and why `tools.approval.eval: allow` above does NOT
59
+ # weaken eval safety: eval stays gated by the bridge's Bash chain (TASK-001).
32
60
  patterns:
33
61
  - match: "rm -rf /*"
34
62
  approval: deny
@@ -294,10 +294,18 @@ function translateExecResult(scriptName, execResult) {
294
294
  if (code === 2) {
295
295
  const structured = parseStructuredDecision(stdout);
296
296
  if (structured?.permissionDecision === 'ask') {
297
+ const askBase = structured.reason || stderr || `${scriptName} requires a human decision`;
298
+ // omp has no native `ask` — hook() converts this to a block. A bare
299
+ // "defers to a human" reason dead-ended under YOLO, so the reason must
300
+ // name the cause class + the recovery action and the chain must surface
301
+ // a display:true note (done in runScriptChain) so a deliberate block is
302
+ // distinguishable from a stall.
297
303
  return {
298
304
  block: false,
299
305
  ask: true,
300
- reason: structured.reason || stderr || `${scriptName} requires a human decision`,
306
+ reason: `${askBase} [UKit ask→block: omp has no native "ask", so this gate decision was surfaced as a block. `
307
+ + 'Recovery: if the cause was an oversized or truncated payload, shrink the payload or re-send it; '
308
+ + 'if the gate is asking for a decision, decide explicitly — answer the question and re-send the call.]',
301
309
  stdout,
302
310
  stderr,
303
311
  };
@@ -628,6 +636,9 @@ export async function runScriptChain(
628
636
  return { block: true, reason: verdict.reason, context, invoked };
629
637
  }
630
638
  if (verdict.ask) {
639
+ // The block must be user-visible, not just model-visible — a deliberate
640
+ // ask→block has to be distinguishable from a silent stall.
641
+ sendContext(pi, [`[UKit] Gate asks for a human decision — the call was blocked: ${verdict.reason}`], 'nextTurn', { display: true });
631
642
  return { block: false, ask: true, reason: verdict.reason, context, invoked };
632
643
  }
633
644
  }
@@ -26,6 +26,14 @@
26
26
  <!-- RULE: EXEC-04 -->
27
27
  - **Every stop says why — no silent idle.** Turns ending on a user-only action open with `WAITING ON YOU: <command/action>` plus a one-shot wakeup (~20-30 min) when available — an ended turn cannot observe external changes, so without it idle looks identical to a stall. Report any error verbatim the same turn.
28
28
 
29
+ ## Stall & Wait Reporting
30
+ <!-- RULE: STALL-01 -->
31
+ - Announce long waits as they happen: `Waiting for API response / tool result — will keep retrying; check your network/API provider if this persists`. Surface any API/tool error **verbatim** in the same turn, and name network/API as the suspect on long stalls — **never blame UKit**. This guidance makes the model's side of a wait visible; it cannot detect a stall inside the host's own request loop.
32
+ <!-- RULE: STALL-02 -->
33
+ - Every stop still says why (Execution Contract EXEC-04) — the stall rules above extend it, they do not replace it.
34
+ <!-- RULE: STALL-03 -->
35
+ - **Conditional workaround only:** fall back to one tool call per assistant message ONLY when malformed/concatenated tool-input errors are observed or the harness version is known-affected — otherwise keep using legitimate parallel calls; serializing healthy hosts contradicts batching guidance.
36
+
29
37
  ## Long-Run Continuity
30
38
  <!-- RULES: LONG-01 LONG-02 -->
31
39
  - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest into `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents. Only then compact.
@@ -69,8 +77,8 @@ For any task needing code context:
69
77
 
70
78
  ## UKit v{{ukit.version}} Shared Runtime
71
79
  - Runtime state lives in `.ukit/storage/`; `.ukit/storage/config.json` holds runtime toggles (compact, token pipeline, router, memory, validation, Safe Patch).
72
- - Reuse `.ukit/storage/memory/` + `ukit memory recall "<current task>"` before asking users to restate decisions; inspect via `ukit status` / `ukit memory export`.
73
- - Route memory: `.claude/ukit/skill-router-state.json` — reuse compact `previous-context`/`recent-output` first. Cache state: `.ukit/storage/cache/output-history.json`, tee/. Missing/corrupt runtime or old `ukit/` root → rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
80
+ - Reuse `.ukit/storage/memory/` + `ukit memory recall "<current task>"` before asking users to restate decisions; `ukit memory learn` surfaces pending proposals, `ukit memory promote` writes approved rules to MEMORY.md, `ukit memory episode` records session episodes; inspect via `ukit status` / `ukit memory export`.
81
+ - Route memory: `.claude/ukit/skill-router-state.json` — reuse compact `previous-context`/`recent-output` first. Cache state: `.ukit/storage/cache/output-history.json`, `retriever-lanes.jsonl`, `tee/`. Lifecycle hooks all degrade to exit 0 (SessionEnd `session-episode.sh` auto-writes episodes; full map: `docs/UKIT_INTERNALS.md`). Missing/corrupt runtime or old `ukit/` root → rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
74
82
 
75
83
  ## Prompt Caching
76
84
  <!-- RULES: CTX-01 CTX-02 CTX-03 CTX-04 CTX-05 CTX-06 CTX-07 CTX-08 CTX-09 CTX-10 -->
@@ -84,9 +92,7 @@ For any task needing code context:
84
92
 
85
93
  ## Handoff Quality Gate — OPT-IN
86
94
  <!-- RULE: HAND-01 -->
87
- CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task TASK-xxx" hoặc target là `docs/AI_HANDOFF/tasks/*.md`). Daily prompt → KHÔNG đụng, flow cũ giữ nguyên.
88
-
89
- Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
95
+ CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task TASK-xxx" hoặc target là `docs/AI_HANDOFF/tasks/*.md`). Daily prompt → KHÔNG đụng, flow cũ giữ nguyên. Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
90
96
 
91
97
  ## Context + Verification Budget
92
98
  <!-- RULE: BUDGET-01 -->
@@ -99,14 +105,10 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
99
105
  - `docs/STATUS.md` captures compact current state — not source truth, never replaces source/index-first investigation.
100
106
  - "What next?"/"continue" → `next-step` with a freshness cue; after meaningful work → `update-status`. `docs/TASKS.md` is the local AI task queue — prefer `Ready for AI`. Detail: `docs/UKIT_INTERNALS.md`.
101
107
 
102
- ## Small-Task Maintainer (internal)
108
+ ## Subagent Lanes (internal)
103
109
  <!-- RULE: SUBAG-02 -->
104
110
  - The `ukit-small-task-maintainer` subagent (`subagents.smallTaskModel`, default `unic-lite`) handles safe/reversible UKit chores as a sidecar lane — never block or slow the user task; risky work hands back to the main model. Detail: `docs/UKIT_INTERNALS.md`.
105
-
106
- ## Post-Edit Sidecar Review (internal)
107
111
  - When routed state's `routeSummary.line` carries `review=code-reviewer(diff)`, launch `code-reviewer` in background (`smart` tier) **only after** write + verification evidence; findings advisory — never block the reported completion. Detail: `docs/UKIT_INTERNALS.md`.
108
-
109
- ## Selective Subagent Policy (internal only)
110
112
  <!-- RULE: SUBAG-01 -->
111
113
  - Direct execution is default for trivial/simple work; delegate only on meaningful context shrink or parallel gains (noisy side lanes, 3+ independent failures, batch plans). Never ask end users to name agents or remember agent commands.
112
114
 
@@ -114,6 +116,16 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
114
116
  <!-- RULE: AUTO-01 -->
115
117
  - `autonomy.level` in `.ukit/storage/config.json` controls how much UKit acts without asking: `conservative` (ask more), `balanced` (default), `free-run` (auto-run more), `vibecode` (one prompt to a finished result; the gate stops only on completion evidence, a genuine blocker, or a dangerous-command decision). End users should not need to change it.
116
118
 
119
+ ## Unattended Completion Loop
120
+ <!-- RULE: UNATTENDED-01 -->
121
+ - Under `orchestration.permissionMode: unattended` there is no human in the loop — the loop is UNDERSTAND → PLAN → IMPLEMENT → VERIFY → FIX → REVERIFY → COMPLETE. A turn ends only on COMPLETE evidence, a real external blocker, or a deny decision.
122
+ <!-- RULE: UNATTENDED-02 -->
123
+ - `maxAttemptsPerFailure: 5` per failing verification, `maxRecoveryStrategies: 3` distinct fix strategies before reassessing — retry the same edit, fix the cause differently, then reduce scope/approach; do not loop one strategy.
124
+ <!-- RULE: UNATTENDED-03 -->
125
+ - BLOCKED only on true external blockers: missing credentials, dead service, unreachable network/API. Test failures, lint errors, review findings, and ambiguity are NOT blockers — they feed FIX.
126
+ <!-- RULE: UNATTENDED-04 -->
127
+ - A deny (hook/gate/permission) never becomes a question: pick the next safer alternative that satisfies the intent and record the substitution. Never emit "do you want me to…" — decide and proceed.
128
+
117
129
  ## 3-Tier Model Routing
118
130
  <!-- RULES: TIER-01 TIER-02 -->
119
131
  **Internal orchestration only — end users still just use natural language. No new commands.**
@@ -26,6 +26,14 @@
26
26
  <!-- RULE: EXEC-04 -->
27
27
  - **Every stop says why — no silent idle.** Turns ending on a user-only action open with `WAITING ON YOU: <command/action>` plus a one-shot wakeup (~20-30 min) when available — an ended turn cannot observe external changes, so without it idle looks identical to a stall. Report any error verbatim the same turn.
28
28
 
29
+ ## Stall & Wait Reporting
30
+ <!-- RULE: STALL-01 -->
31
+ - Announce long waits as they happen: `Waiting for API response / tool result — will keep retrying; check your network/API provider if this persists`. Surface any API/tool error **verbatim** in the same turn, and name network/API as the suspect on long stalls — **never blame UKit**. This guidance makes the model's side of a wait visible; it cannot detect a stall inside the host's own request loop.
32
+ <!-- RULE: STALL-02 -->
33
+ - Every stop still says why (Execution Contract EXEC-04) — the stall rules above extend it, they do not replace it.
34
+ <!-- RULE: STALL-03 -->
35
+ - **Conditional workaround only:** fall back to one tool call per assistant message ONLY when malformed/concatenated tool-input errors are observed or the harness version is known-affected — otherwise keep using legitimate parallel calls; serializing healthy hosts contradicts batching guidance.
36
+
29
37
  ## Long-Run Continuity
30
38
  <!-- RULES: LONG-01 LONG-02 -->
31
39
  - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest into `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents. Only then compact.
@@ -69,8 +77,8 @@ For any task needing code context:
69
77
 
70
78
  ## UKit v{{ukit.version}} Shared Runtime
71
79
  - Runtime state lives in `.ukit/storage/`; `.ukit/storage/config.json` holds runtime toggles (compact, token pipeline, router, memory, validation, Safe Patch).
72
- - Reuse `.ukit/storage/memory/` + `ukit memory recall "<current task>"` before asking users to restate decisions; inspect via `ukit status` / `ukit memory export`.
73
- - Route memory: `.claude/ukit/skill-router-state.json` — reuse compact `previous-context`/`recent-output` first. Cache state: `.ukit/storage/cache/output-history.json`, tee/. Missing/corrupt runtime or old `ukit/` root → rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
80
+ - Reuse `.ukit/storage/memory/` + `ukit memory recall "<current task>"` before asking users to restate decisions; `ukit memory learn` surfaces pending proposals, `ukit memory promote` writes approved rules to MEMORY.md, `ukit memory episode` records session episodes; inspect via `ukit status` / `ukit memory export`.
81
+ - Route memory: `.claude/ukit/skill-router-state.json` — reuse compact `previous-context`/`recent-output` first. Cache state: `.ukit/storage/cache/output-history.json`, `retriever-lanes.jsonl`, `tee/`. Lifecycle hooks all degrade to exit 0 (SessionEnd `session-episode.sh` auto-writes episodes; full map: `docs/UKIT_INTERNALS.md`). Missing/corrupt runtime or old `ukit/` root → rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
74
82
 
75
83
  ## Prompt Caching
76
84
  <!-- RULES: CTX-01 CTX-02 CTX-03 CTX-04 CTX-05 CTX-06 CTX-07 CTX-08 CTX-09 CTX-10 -->
@@ -84,9 +92,7 @@ For any task needing code context:
84
92
 
85
93
  ## Handoff Quality Gate — OPT-IN
86
94
  <!-- RULE: HAND-01 -->
87
- CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task TASK-xxx" hoặc target là `docs/AI_HANDOFF/tasks/*.md`). Daily prompt → KHÔNG đụng, flow cũ giữ nguyên.
88
-
89
- Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
95
+ CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task TASK-xxx" hoặc target là `docs/AI_HANDOFF/tasks/*.md`). Daily prompt → KHÔNG đụng, flow cũ giữ nguyên. Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
90
96
 
91
97
  ## Context + Verification Budget
92
98
  <!-- RULE: BUDGET-01 -->
@@ -99,14 +105,10 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
99
105
  - `docs/STATUS.md` captures compact current state — not source truth, never replaces source/index-first investigation.
100
106
  - "What next?"/"continue" → `next-step` with a freshness cue; after meaningful work → `update-status`. `docs/TASKS.md` is the local AI task queue — prefer `Ready for AI`. Detail: `docs/UKIT_INTERNALS.md`.
101
107
 
102
- ## Small-Task Maintainer (internal)
108
+ ## Subagent Lanes (internal)
103
109
  <!-- RULE: SUBAG-02 -->
104
110
  - The `ukit-small-task-maintainer` subagent (`subagents.smallTaskModel`, default `unic-lite`) handles safe/reversible UKit chores as a sidecar lane — never block or slow the user task; risky work hands back to the main model. Detail: `docs/UKIT_INTERNALS.md`.
105
-
106
- ## Post-Edit Sidecar Review (internal)
107
111
  - When routed state's `routeSummary.line` carries `review=code-reviewer(diff)`, launch `code-reviewer` in background (`smart` tier) **only after** write + verification evidence; findings advisory — never block the reported completion. Detail: `docs/UKIT_INTERNALS.md`.
108
-
109
- ## Selective Subagent Policy (internal only)
110
112
  <!-- RULE: SUBAG-01 -->
111
113
  - Direct execution is default for trivial/simple work; delegate only on meaningful context shrink or parallel gains (noisy side lanes, 3+ independent failures, batch plans). Never ask end users to name agents or remember agent commands.
112
114
 
@@ -114,6 +116,16 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
114
116
  <!-- RULE: AUTO-01 -->
115
117
  - `autonomy.level` in `.ukit/storage/config.json` controls how much UKit acts without asking: `conservative` (ask more), `balanced` (default), `free-run` (auto-run more), `vibecode` (one prompt to a finished result; the gate stops only on completion evidence, a genuine blocker, or a dangerous-command decision). End users should not need to change it.
116
118
 
119
+ ## Unattended Completion Loop
120
+ <!-- RULE: UNATTENDED-01 -->
121
+ - Under `orchestration.permissionMode: unattended` there is no human in the loop — the loop is UNDERSTAND → PLAN → IMPLEMENT → VERIFY → FIX → REVERIFY → COMPLETE. A turn ends only on COMPLETE evidence, a real external blocker, or a deny decision.
122
+ <!-- RULE: UNATTENDED-02 -->
123
+ - `maxAttemptsPerFailure: 5` per failing verification, `maxRecoveryStrategies: 3` distinct fix strategies before reassessing — retry the same edit, fix the cause differently, then reduce scope/approach; do not loop one strategy.
124
+ <!-- RULE: UNATTENDED-03 -->
125
+ - BLOCKED only on true external blockers: missing credentials, dead service, unreachable network/API. Test failures, lint errors, review findings, and ambiguity are NOT blockers — they feed FIX.
126
+ <!-- RULE: UNATTENDED-04 -->
127
+ - A deny (hook/gate/permission) never becomes a question: pick the next safer alternative that satisfies the intent and record the substitution. Never emit "do you want me to…" — decide and proceed.
128
+
117
129
  ## 3-Tier Model Routing
118
130
  <!-- RULES: TIER-01 TIER-02 -->
119
131
  **Internal orchestration only — end users still just use natural language. No new commands.**
@@ -1 +1 @@
1
- {"$schema":"https://opencode.ai/config.json","default_agent":"build","share":"disabled","compaction":{"auto":true,"prune":true,"reserved":10000},"watcher":{"ignore":[".git/**","node_modules/**",".cache/**",".ukit/**",".claude/ukit/permission-usage.json",".claude/ukit/permission-audit.log"]},"permission":{"doom_loop":"deny"},"command":{"ukit-route":{"description":"Internal shared UKit route. Run at the start of every non-trivial task to get skill and context hints before writing code.","agent":"build","template":"Run `node .claude/ukit/index/route-task.mjs \"<task>\" --adapter opencode`; reuse `.claude/ukit/skill-router-state.json`."},"ukit-context":{"description":"Internal UKit context.","agent":"build","template":"Run `node .claude/ukit/index/resolve-context.mjs \"<intent>\" [--target <file>]`."},"ukit-verify":{"description":"Internal UKit verify lane.","agent":"build","template":"Run `node .claude/ukit/index/verify-context.mjs \"<intent>\" [--target <file>]`."},"ukit-triage":{"description":"Internal UKit triage.","agent":"build","template":"Run `node .claude/ukit/index/triage.mjs \"<error>\"`."},"ukit-query":{"description":"Internal UKit query.","agent":"build","template":"Run `node .claude/ukit/index/query-index.mjs \"<error|symbol|path>\"`."},"ukit-index":{"description":"Internal UKit index.","agent":"build","template":"Run `node .claude/ukit/index/refresh-index.mjs` (fallback: `node .claude/ukit/index/build-index.mjs`)."},"ukit-handoff-status":{"description":"Handoff dashboard — show current cycle status (read-only).","agent":"build","template":"Read `docs/AI_HANDOFF/INDEX.md`, `docs/AI_HANDOFF/ACTIVE.md`, and `docs/AI_HANDOFF/PLAN.md`. Report: active cycle name, task table with status, any blockers. No writes."},"ukit-handoff-create":{"description":"Create a new handoff cycle — Phase 1+2: write PLAN.md + TASK-xxx.md files.","agent":"build","template":"Read `.claude/commands/ukit/create-handoff.md` for full instructions, then execute. Description: <what to build>"},"ukit-handoff-implement":{"description":"Execute handoff tasks — Phase 3: implement the next Ready task.","agent":"build","template":"Read `.claude/commands/ukit/implement-handoff.md` for full instructions, then execute. Task ID (optional): <TASK-xxx>"},"ukit-handoff-review":{"description":"Review handoff results — Phase 4: verify implementation and give verdict.","agent":"build","template":"Read `.claude/commands/ukit/review-handoff.md` for full instructions, then execute. Task ID (optional): <TASK-xxx>"},"ukit-handoff-clear":{"description":"Archive and reset the current handoff cycle.","agent":"build","template":"Read `.claude/commands/ukit/clear-handoff.md` for full instructions, then execute."}},"agent":{"build":{"description":"UKit build agent. Follow AGENTS.md. For every non-trivial task: run /ukit-route first, use index-first loop, activate matching skill, never claim done after read-only steps. Keep internal ukit-* helpers hidden; users only need ukit install.","permission":{"edit":"allow","task":"allow","skill":"allow","bash":{"*":"ask","pwd":"allow","ls":"allow","ls *":"allow","find *":"allow","rg *":"allow","grep *":"allow","cat *":"allow","sed *":"allow","head *":"allow","tail *":"allow","wc *":"allow","echo *":"allow","printf *":"allow","awk *":"allow","tr *":"allow","cut *":"allow","sort *":"allow","uniq *":"allow","diff *":"allow","jq *":"allow","stat *":"allow","file *":"allow","which *":"allow","date *":"allow","basename *":"allow","dirname *":"allow","realpath *":"allow","xargs *":"allow","mkdir *":"allow","touch *":"allow","cp *":"allow","vitest *":"allow","jest *":"allow","git status":"allow","git status *":"allow","git diff":"allow","git diff *":"allow","git log":"allow","git log *":"allow","git show *":"allow","git grep *":"allow","git rev-parse *":"allow","git branch *":"allow","git stash list":"allow","git ls-files *":"allow","git tag *":"allow","node .claude/ukit/index/*":"allow","node .claude/ukit/runtime/*":"allow","{{runtime.packageManager}} test":"allow","{{runtime.packageManager}} test *":"allow","{{runtime.packageManager}} lint":"allow","{{runtime.packageManager}} lint *":"allow","{{runtime.packageManager}} typecheck":"allow","{{runtime.packageManager}} typecheck *":"allow","{{runtime.packageManager}} build":"allow","{{runtime.packageManager}} build *":"allow","npm run test":"allow","npm run test *":"allow","npm run lint":"allow","npm run lint *":"allow","npm run typecheck":"allow","npm run typecheck *":"allow","npm run build":"allow","npm run build *":"allow","pnpm test":"allow","pnpm test *":"allow","pnpm lint":"allow","pnpm lint *":"allow","pnpm typecheck":"allow","pnpm typecheck *":"allow","pnpm build":"allow","pnpm build *":"allow","pnpm run test":"allow","pnpm run test *":"allow","pnpm run lint":"allow","pnpm run lint *":"allow","pnpm run typecheck":"allow","pnpm run typecheck *":"allow","pnpm run build":"allow","pnpm run build *":"allow","bun test":"allow","bun test *":"allow","bun run test":"allow","bun run test *":"allow","bun run lint":"allow","bun run lint *":"allow","bun run typecheck":"allow","bun run typecheck *":"allow","bun run build":"allow","bun run build *":"allow","git commit":"ask","git commit *":"ask","git push":"ask","git push *":"ask","git clean":"deny","git clean *":"deny","git reset":"deny","git reset *":"deny","rm *":"deny"}}},"plan":{"permission":{"edit":"ask","bash":"ask"}}}}
1
+ {"$schema":"https://opencode.ai/config.json","default_agent":"build","share":"disabled","compaction":{"auto":true,"prune":true,"reserved":10000},"watcher":{"ignore":[".git/**","node_modules/**",".cache/**",".ukit/**",".claude/ukit/permission-usage.json",".claude/ukit/permission-audit.log"]},"permission":{"doom_loop":"deny"},"command":{"ukit-route":{"description":"Internal shared UKit route. Run at the start of every non-trivial task to get skill and context hints before writing code.","agent":"build","template":"Run `node .claude/ukit/index/route-task.mjs \"<task>\" --adapter opencode`; reuse `.claude/ukit/skill-router-state.json`."},"ukit-context":{"description":"Internal UKit context.","agent":"build","template":"Run `node .claude/ukit/index/resolve-context.mjs \"<intent>\" [--target <file>]`."},"ukit-verify":{"description":"Internal UKit verify lane.","agent":"build","template":"Run `node .claude/ukit/index/verify-context.mjs \"<intent>\" [--target <file>]`."},"ukit-triage":{"description":"Internal UKit triage.","agent":"build","template":"Run `node .claude/ukit/index/triage.mjs \"<error>\"`."},"ukit-query":{"description":"Internal UKit query.","agent":"build","template":"Run `node .claude/ukit/index/query-index.mjs \"<error|symbol|path>\"`."},"ukit-index":{"description":"Internal UKit index.","agent":"build","template":"Run `node .claude/ukit/index/refresh-index.mjs` (fallback: `node .claude/ukit/index/build-index.mjs`)."},"ukit-handoff-status":{"description":"Handoff dashboard — show current cycle status (read-only).","agent":"build","template":"Read `docs/AI_HANDOFF/INDEX.md`, `docs/AI_HANDOFF/ACTIVE.md`, and `docs/AI_HANDOFF/PLAN.md`. Report: active cycle name, task table with status, any blockers. No writes."},"ukit-handoff-create":{"description":"Create a new handoff cycle — Phase 1+2: write PLAN.md + TASK-xxx.md files.","agent":"build","template":"Read `.claude/commands/ukit/create-handoff.md` for full instructions, then execute. Description: <what to build>"},"ukit-handoff-implement":{"description":"Execute handoff tasks — Phase 3: implement the next Ready task.","agent":"build","template":"Read `.claude/commands/ukit/implement-handoff.md` for full instructions, then execute. Task ID (optional): <TASK-xxx>"},"ukit-handoff-review":{"description":"Review handoff results — Phase 4: verify implementation and give verdict.","agent":"build","template":"Read `.claude/commands/ukit/review-handoff.md` for full instructions, then execute. Task ID (optional): <TASK-xxx>"},"ukit-handoff-clear":{"description":"Archive and reset the current handoff cycle.","agent":"build","template":"Read `.claude/commands/ukit/clear-handoff.md` for full instructions, then execute."}},"agent":{"build":{"description":"UKit build agent. Follow AGENTS.md. For every non-trivial task: run /ukit-route first, use index-first loop, activate matching skill, never claim done after read-only steps. Keep internal ukit-* helpers hidden; users only need ukit install.","permission":{"edit":"allow","task":"allow","skill":"allow","bash":{"*":"ask","pwd":"allow","ls":"allow","ls *":"allow","find *":"allow","rg *":"allow","grep *":"allow","cat *":"allow","sed *":"allow","head *":"allow","tail *":"allow","wc *":"allow","echo *":"allow","printf *":"allow","awk *":"allow","tr *":"allow","cut *":"allow","sort *":"allow","uniq *":"allow","diff *":"allow","jq *":"allow","stat *":"allow","file *":"allow","which *":"allow","date *":"allow","basename *":"allow","dirname *":"allow","realpath *":"allow","xargs *":"allow","mkdir *":"allow","touch *":"allow","cp *":"allow","vitest *":"allow","jest *":"allow","git status":"allow","git status *":"allow","git diff":"allow","git diff *":"allow","git log":"allow","git log *":"allow","git show *":"allow","git grep *":"allow","git rev-parse *":"allow","git branch *":"allow","git stash list":"allow","git ls-files *":"allow","git tag *":"allow","git add *":"allow","git checkout *":"allow","git switch *":"allow","git restore *":"allow","git mv *":"allow","mv *":"allow","node *":"allow","node .claude/ukit/index/*":"allow","node .claude/ukit/runtime/*":"allow","npx *":"allow","npm test":"allow","npm test *":"allow","{{runtime.packageManager}} test":"allow","{{runtime.packageManager}} test *":"allow","{{runtime.packageManager}} lint":"allow","{{runtime.packageManager}} lint *":"allow","{{runtime.packageManager}} typecheck":"allow","{{runtime.packageManager}} typecheck *":"allow","{{runtime.packageManager}} build":"allow","{{runtime.packageManager}} build *":"allow","npm run test":"allow","npm run test *":"allow","npm run lint":"allow","npm run lint *":"allow","npm run typecheck":"allow","npm run typecheck *":"allow","npm run build":"allow","npm run build *":"allow","pnpm test":"allow","pnpm test *":"allow","pnpm lint":"allow","pnpm lint *":"allow","pnpm typecheck":"allow","pnpm typecheck *":"allow","pnpm build":"allow","pnpm build *":"allow","pnpm run test":"allow","pnpm run test *":"allow","pnpm run lint":"allow","pnpm run lint *":"allow","pnpm run typecheck":"allow","pnpm run typecheck *":"allow","pnpm run build":"allow","pnpm run build *":"allow","bun test":"allow","bun test *":"allow","bun run test":"allow","bun run test *":"allow","bun run lint":"allow","bun run lint *":"allow","bun run typecheck":"allow","bun run typecheck *":"allow","bun run build":"allow","bun run build *":"allow","git commit":"allow","git commit *":"allow","git push":"allow","git push *":"allow","git clean":"deny","git clean *":"deny","git reset":"deny","git reset *":"deny","rm *":"deny"}}},"plan":{"permission":{"edit":"ask","bash":"ask"}}}}
@@ -23,6 +23,14 @@
23
23
  <!-- RULE: EXEC-04 -->
24
24
  - **Every stop says why — no silent idle.** Turns ending on a user-only action open with `WAITING ON YOU: <command/action>` plus a one-shot wakeup (~20-30 min) when available — an ended turn cannot observe external changes, so without it idle looks identical to a stall. Report any error verbatim the same turn.
25
25
 
26
+ ## Stall & Wait Reporting
27
+ <!-- RULE: STALL-01 -->
28
+ - Announce long waits as they happen: `Waiting for API response / tool result — will keep retrying; check your network/API provider if this persists`. Surface any API/tool error **verbatim** in the same turn, and name network/API as the suspect on long stalls — **never blame UKit**. This guidance makes the model's side of a wait visible; it cannot detect a stall inside the host's own request loop.
29
+ <!-- RULE: STALL-02 -->
30
+ - Every stop still says why (Execution Contract EXEC-04) — the stall rules above extend it, they do not replace it.
31
+ <!-- RULE: STALL-03 -->
32
+ - **Conditional workaround only:** fall back to one tool call per assistant message ONLY when malformed/concatenated tool-input errors are observed or the harness version is known-affected — otherwise keep using legitimate parallel calls; serializing healthy hosts contradicts batching guidance.
33
+
26
34
  ## Long-Run Continuity
27
35
  <!-- RULES: LONG-01 LONG-02 -->
28
36
  - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest into `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents. Only then compact.
@@ -66,8 +74,8 @@ For any task needing code context:
66
74
 
67
75
  ## UKit v{{ukit.version}} Shared Runtime
68
76
  - Runtime state lives in `.ukit/storage/`; `.ukit/storage/config.json` holds runtime toggles (compact, token pipeline, router, memory, validation, Safe Patch).
69
- - Reuse `.ukit/storage/memory/` + `ukit memory recall "<current task>"` before asking users to restate decisions; inspect via `ukit status` / `ukit memory export`.
70
- - Route memory: `.claude/ukit/skill-router-state.json` — reuse compact `previous-context`/`recent-output` first. Cache state: `.ukit/storage/cache/output-history.json`, tee/. Missing/corrupt runtime or old `ukit/` root → rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
77
+ - Reuse `.ukit/storage/memory/` + `ukit memory recall "<current task>"` before asking users to restate decisions; `ukit memory learn` surfaces pending proposals, `ukit memory promote` writes approved rules to MEMORY.md, `ukit memory episode` records session episodes; inspect via `ukit status` / `ukit memory export`.
78
+ - Route memory: `.claude/ukit/skill-router-state.json` — reuse compact `previous-context`/`recent-output` first. Cache state: `.ukit/storage/cache/output-history.json`, `retriever-lanes.jsonl`, `tee/`. Lifecycle hooks all degrade to exit 0 (SessionEnd `session-episode.sh` auto-writes episodes; full map: `docs/UKIT_INTERNALS.md`). Missing/corrupt runtime or old `ukit/` root → rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
71
79
 
72
80
  ## Prompt Caching
73
81
  <!-- RULES: CTX-01 CTX-02 CTX-03 CTX-04 CTX-05 CTX-06 CTX-07 CTX-08 CTX-09 CTX-10 -->
@@ -81,9 +89,7 @@ For any task needing code context:
81
89
 
82
90
  ## Handoff Quality Gate — OPT-IN
83
91
  <!-- RULE: HAND-01 -->
84
- CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task TASK-xxx" hoặc target là `docs/AI_HANDOFF/tasks/*.md`). Daily prompt → KHÔNG đụng, flow cũ giữ nguyên.
85
-
86
- Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
92
+ CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task TASK-xxx" hoặc target là `docs/AI_HANDOFF/tasks/*.md`). Daily prompt → KHÔNG đụng, flow cũ giữ nguyên. Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
87
93
 
88
94
  ## Context + Verification Budget
89
95
  <!-- RULE: BUDGET-01 -->
@@ -96,14 +102,10 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
96
102
  - `docs/STATUS.md` captures compact current state — not source truth, never replaces source/index-first investigation.
97
103
  - "What next?"/"continue" → `next-step` with a freshness cue; after meaningful work → `update-status`. `docs/TASKS.md` is the local AI task queue — prefer `Ready for AI`. Detail: `docs/UKIT_INTERNALS.md`.
98
104
 
99
- ## Small-Task Maintainer (internal)
105
+ ## Subagent Lanes (internal)
100
106
  <!-- RULE: SUBAG-02 -->
101
107
  - The `ukit-small-task-maintainer` subagent (`subagents.smallTaskModel`, default `unic-lite`) handles safe/reversible UKit chores as a sidecar lane — never block or slow the user task; risky work hands back to the main model. Detail: `docs/UKIT_INTERNALS.md`.
102
-
103
- ## Post-Edit Sidecar Review (internal)
104
108
  - When routed state's `routeSummary.line` carries `review=code-reviewer(diff)`, launch `code-reviewer` in background (`smart` tier) **only after** write + verification evidence; findings advisory — never block the reported completion. Detail: `docs/UKIT_INTERNALS.md`.
105
-
106
- ## Selective Subagent Policy (internal only)
107
109
  <!-- RULE: SUBAG-01 -->
108
110
  - Direct execution is default for trivial/simple work; delegate only on meaningful context shrink or parallel gains (noisy side lanes, 3+ independent failures, batch plans). Never ask end users to name agents or remember agent commands.
109
111
 
@@ -111,6 +113,16 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
111
113
  <!-- RULE: AUTO-01 -->
112
114
  - `autonomy.level` in `.ukit/storage/config.json` controls how much UKit acts without asking: `conservative` (ask more), `balanced` (default), `free-run` (auto-run more), `vibecode` (one prompt to a finished result; the gate stops only on completion evidence, a genuine blocker, or a dangerous-command decision). End users should not need to change it.
113
115
 
116
+ ## Unattended Completion Loop
117
+ <!-- RULE: UNATTENDED-01 -->
118
+ - Under `orchestration.permissionMode: unattended` there is no human in the loop — the loop is UNDERSTAND → PLAN → IMPLEMENT → VERIFY → FIX → REVERIFY → COMPLETE. A turn ends only on COMPLETE evidence, a real external blocker, or a deny decision.
119
+ <!-- RULE: UNATTENDED-02 -->
120
+ - `maxAttemptsPerFailure: 5` per failing verification, `maxRecoveryStrategies: 3` distinct fix strategies before reassessing — retry the same edit, fix the cause differently, then reduce scope/approach; do not loop one strategy.
121
+ <!-- RULE: UNATTENDED-03 -->
122
+ - BLOCKED only on true external blockers: missing credentials, dead service, unreachable network/API. Test failures, lint errors, review findings, and ambiguity are NOT blockers — they feed FIX.
123
+ <!-- RULE: UNATTENDED-04 -->
124
+ - A deny (hook/gate/permission) never becomes a question: pick the next safer alternative that satisfies the intent and record the substitution. Never emit "do you want me to…" — decide and proceed.
125
+
114
126
  ## 3-Tier Model Routing
115
127
  <!-- RULES: TIER-01 TIER-02 -->
116
128
  **Internal orchestration only — end users still just use natural language. No new commands.**
@@ -14,6 +14,7 @@ outputs:
14
14
  - { from: core, heading: Core Rule }
15
15
  - { from: core, heading: Fast Classification }
16
16
  - { from: core, heading: Execution Contract (mandatory) }
17
+ - { from: core, heading: Stall & Wait Reporting }
17
18
  - { from: core, heading: Long-Run Continuity }
18
19
  - { from: core, heading: Index-First Loop }
19
20
  - { from: core, heading: Automatic Skill Activation (mandatory) }
@@ -25,10 +26,9 @@ outputs:
25
26
  - { from: core, heading: Handoff Quality Gate — OPT-IN }
26
27
  - { from: core, heading: Context + Verification Budget }
27
28
  - { from: core, heading: Living Status Workflow }
28
- - { from: core, heading: Small-Task Maintainer (internal) }
29
- - { from: core, heading: Post-Edit Sidecar Review (internal) }
30
- - { from: core, heading: Selective Subagent Policy (internal only) }
29
+ - { from: core, heading: Subagent Lanes (internal) }
31
30
  - { from: core, heading: Adaptive Autonomy }
31
+ - { from: core, heading: Unattended Completion Loop }
32
32
  - { from: core, heading: 3-Tier Model Routing }
33
33
  - { from: core, heading: Skills }
34
34
  - { from: core, heading: Project Snapshot }
@@ -46,6 +46,7 @@ outputs:
46
46
  - { from: core, heading: Core Rule }
47
47
  - { from: core, heading: Fast Classification }
48
48
  - { from: core, heading: Execution Contract (mandatory) }
49
+ - { from: core, heading: Stall & Wait Reporting }
49
50
  - { from: core, heading: Long-Run Continuity }
50
51
  - { from: core, heading: Index-First Loop }
51
52
  - { from: core, heading: Automatic Skill Activation (mandatory) }
@@ -57,10 +58,9 @@ outputs:
57
58
  - { from: core, heading: Handoff Quality Gate — OPT-IN }
58
59
  - { from: core, heading: Context + Verification Budget }
59
60
  - { from: core, heading: Living Status Workflow }
60
- - { from: core, heading: Small-Task Maintainer (internal) }
61
- - { from: core, heading: Post-Edit Sidecar Review (internal) }
62
- - { from: core, heading: Selective Subagent Policy (internal only) }
61
+ - { from: core, heading: Subagent Lanes (internal) }
63
62
  - { from: core, heading: Adaptive Autonomy }
63
+ - { from: core, heading: Unattended Completion Loop }
64
64
  - { from: core, heading: 3-Tier Model Routing }
65
65
  - { from: 'overlay:agents', heading: Session Start — OpenCode }
66
66
  - { from: 'overlay:agents', heading: Project Owner Instructions — Codex and OpenCode }
@@ -88,6 +88,7 @@ outputs:
88
88
  - { from: core, heading: Core Rule }
89
89
  - { from: core, heading: Fast Classification }
90
90
  - { from: core, heading: Execution Contract (mandatory) }
91
+ - { from: core, heading: Stall & Wait Reporting }
91
92
  - { from: core, heading: Long-Run Continuity }
92
93
  - { from: core, heading: Index-First Loop }
93
94
  - { from: core, heading: Automatic Skill Activation (mandatory) }
@@ -99,10 +100,9 @@ outputs:
99
100
  - { from: core, heading: Handoff Quality Gate — OPT-IN }
100
101
  - { from: core, heading: Context + Verification Budget }
101
102
  - { from: core, heading: Living Status Workflow }
102
- - { from: core, heading: Small-Task Maintainer (internal) }
103
- - { from: core, heading: Post-Edit Sidecar Review (internal) }
104
- - { from: core, heading: Selective Subagent Policy (internal only) }
103
+ - { from: core, heading: Subagent Lanes (internal) }
105
104
  - { from: core, heading: Adaptive Autonomy }
105
+ - { from: core, heading: Unattended Completion Loop }
106
106
  - { from: core, heading: 3-Tier Model Routing }
107
107
  - { from: core, heading: Skills }
108
108
  - { from: core, heading: Project Snapshot }
@@ -121,6 +121,7 @@ outputs:
121
121
  - { from: core, heading: Core Rule }
122
122
  - { from: core, heading: Fast Classification }
123
123
  - { from: core, heading: Execution Contract (mandatory) }
124
+ - { from: core, heading: Stall & Wait Reporting }
124
125
  - { from: core, heading: Long-Run Continuity }
125
126
  - { from: core, heading: Index-First Loop }
126
127
  - { from: core, heading: Automatic Skill Activation (mandatory) }
@@ -132,10 +133,9 @@ outputs:
132
133
  - { from: core, heading: Handoff Quality Gate — OPT-IN }
133
134
  - { from: core, heading: Context + Verification Budget }
134
135
  - { from: core, heading: Living Status Workflow }
135
- - { from: core, heading: Small-Task Maintainer (internal) }
136
- - { from: core, heading: Post-Edit Sidecar Review (internal) }
137
- - { from: core, heading: Selective Subagent Policy (internal only) }
136
+ - { from: core, heading: Subagent Lanes (internal) }
138
137
  - { from: core, heading: Adaptive Autonomy }
138
+ - { from: core, heading: Unattended Completion Loop }
139
139
  - { from: core, heading: 3-Tier Model Routing }
140
140
  - { from: 'overlay:agents', heading: Session Start — OpenCode }
141
141
  - { from: 'overlay:agents', heading: Project Owner Instructions — Codex and OpenCode }
@@ -93,6 +93,7 @@
93
93
  "enabled": true,
94
94
  "orchestratorModel": "claude-sonnet-5",
95
95
  "advisorEnabled": true,
96
+ "permissionMode": "unattended",
96
97
  "contracts": {
97
98
  "tiny-fix": {
98
99
  "maxReadPasses": 0,
@@ -554,6 +555,7 @@
554
555
  "enabled": "Bật ladder điều phối nội bộ của UKit. Ladder này thay cách nghĩ LITE/FULL cứng nhắc bằng các tầng tiny-fix → review-release an toàn hơn.",
555
556
  "orchestratorModel": "Model điều phối chất lượng cao để chọn execution layer. Đây là model quan trọng cho chất lượng completion, không nên dùng model quá yếu.",
556
557
  "advisorEnabled": "Cho phép UKit dùng advisor-style reasoning khi chọn layer trong tình huống mơ hồ.",
558
+ "permissionMode": "Chế độ quyền của orchestration. Ba giá trị dành riêng: interactive, safe-auto, unattended. Chu kỳ này chỉ triển khai unattended.",
557
559
  "contracts": "Bộ contract cho 7 tầng điều phối: tiny-fix, local-fix, local-build, find-cause, shared-edit, map-impact, review-release. Khi mơ hồ, UKit nên lệch lên tầng an toàn hơn dù tốn token hơn."
558
560
  },
559
561
  "memory": {