@ngockhoale/ukit 2.1.5 → 2.2.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +7 -4
  3. package/manifests/platform.full.yaml +121 -24
  4. package/package.json +4 -3
  5. package/src/cli/adapters.js +47 -21
  6. package/src/cli/index.js +2 -2
  7. package/src/core/applyPlan.js +5 -2
  8. package/src/core/ensureGitignore.js +2 -0
  9. package/src/core/runInstallPipeline.js +19 -0
  10. package/src/core/runtimeConfig.js +6 -1
  11. package/src/core/status.js +3 -1
  12. package/src/core/uninstall.js +16 -0
  13. package/src/index/routeCatalog.js +1 -1
  14. package/src/manifest/selectItems.js +11 -5
  15. package/templates/.claude/commands/ukit/handoff-clear.md +1 -1
  16. package/templates/.claude/commands/ukit/handoff-create.md +10 -8
  17. package/templates/.claude/commands/ukit/handoff-fullstack.md +22 -18
  18. package/templates/.claude/commands/ukit/handoff-implement.md +6 -4
  19. package/templates/.claude/commands/ukit/handoff-review.md +5 -3
  20. package/templates/.claude/commands/ukit/handoff-status.md +1 -1
  21. package/templates/.claude/ukit/index/route-catalog.mjs +1 -1
  22. package/templates/.claude/ukit/index/unic-gateway.mjs +43 -7
  23. package/templates/.codex/README.md +1 -1
  24. package/templates/.gitignore +2 -0
  25. package/templates/.omp/AGENTS.md +9 -0
  26. package/templates/.omp/README.md +96 -0
  27. package/templates/.omp/RULES.md +62 -0
  28. package/templates/.omp/agents/bug-debugger.md +85 -0
  29. package/templates/.omp/agents/code-reviewer.md +197 -0
  30. package/templates/.omp/agents/feature-implementer.md +123 -0
  31. package/templates/.omp/agents/handoff-planner.md +210 -0
  32. package/templates/.omp/agents/ukit-small-task-maintainer.md +72 -0
  33. package/templates/.omp/agents/ukit-vision-analyst.md +100 -0
  34. package/templates/.omp/config.yml +90 -0
  35. package/templates/.omp/hooks/pre/ukit-bridge.js +368 -0
  36. package/templates/AGENTS.md +132 -64
  37. package/templates/CLAUDE.md +59 -21
  38. package/templates/docs/PROJECT.md +1 -1
  39. package/templates/ukit/storage/config.json +10 -0
  40. package/templates/adapter-presets/antigravity/README.md +0 -22
  41. package/templates/adapter-presets/antigravity/rules.md +0 -49
@@ -1,16 +1,16 @@
1
1
  # AGENTS.md — {{project.name}}
2
2
 
3
- ## Core UKit Rule
3
+ ## Core Rule
4
4
 
5
- - Human-facing workflow should optimize for one remembered command: `ukit install`.
6
- - After install, normal work should feel natural inside **Claude/Codex/OpenCode** (and Antigravity when installed).
7
- - **Quality first, then speed, then token discipline**: do not waste reads, logs, or repeated helper output.
5
+ - Human-facing UKit workflow should collapse to one remembered command: `ukit install`.
6
+ - After install, default to natural-language work inside **Claude Code / Codex / OpenCode / omp**.
7
+ - **Quality first, then speed, then token discipline.**
8
8
  - **Never stop after read-only steps.** For implement/apply/fix requests, continue to actual Edit/Write and verification in the same turn.
9
9
 
10
- ## Fast Task Classification
10
+ ## Fast Classification
11
11
 
12
- - **Trivial** — typo, label, rename nhỏ, spacing, toggle flag, obvious config change.
13
- - Act directly. No doc reads. No planning. No index.
12
+ - **Trivial** — typo, label, small rename, spacing, toggle flag, obvious config change.
13
+ - Act directly. No doc reads. No planning. No index. No agents.
14
14
  - **Simple** — 1-2 files, clear scope, existing pattern.
15
15
  - Handle directly. Pull only the smallest useful context via resolver or targeted read.
16
16
  - **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss.
@@ -44,11 +44,14 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
44
44
  ## Automatic Skill Activation (mandatory)
45
45
 
46
46
  - End users should not need to know skill names.
47
- - For every non-trivial task — and again after the first relevant tool calls — inspect installed project-local skills and **auto-activate the matching skill immediately**.
47
+ - On every non-trivial task — and again after the first relevant tool calls — inspect installed project-local skills and **auto-activate the matching skill immediately**.
48
48
  - Match from both prompt wording and tool/file evidence.
49
49
  - Use the smallest effective set, usually 1-2 skills.
50
50
  - If evidence becomes more specific than the original prompt, upgrade the active skill choice immediately.
51
- - Prefer routed, compact context before widening manual reads.
51
+ - If docs work is detected, read `.claude/skills/docs-quality/SKILL.md` when present.
52
+ - Prefer routed context and routed verification over ad-hoc broad reading.
53
+ - Reuse `.claude/ukit/skill-router-state.json` when it already carries compact route memory.
54
+ - If shared route state already includes `previous-context` or `recent-output`, reuse those first.
52
55
 
53
56
  ### Common skill triggers
54
57
 
@@ -61,51 +64,65 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
61
64
  - auth / security / token / permission / validation / risky shell-path-delete-db work → `.claude/skills/discover-security/SKILL.md`
62
65
  - stale workspace / reinstall / cleanup / maintenance → `.claude/skills/repo-maintenance/SKILL.md`
63
66
 
64
- ## Internal Helper Routing
67
+ ## Internal Helper Policy
65
68
 
66
- - If routing is complex or ambiguous, prefer the canonical helper first: `node .claude/ukit/index/route-task.mjs "<prompt>" [--tool-command <cmd>] [--target <file>]`.
67
- - If context is needed, prefer `node .claude/ukit/index/resolve-context.mjs ...`.
68
- - If a concrete verification lane is needed, prefer `node .claude/ukit/index/verify-context.mjs ...`.
69
- - These helper/index commands are internal orchestration. Run them yourself when needed; never turn them into required end-user workflow.
69
+ - Prefer `node .claude/ukit/index/route-task.mjs "<prompt>" [--tool-command <cmd>] [--target <file>]` when routing is complex or ambiguous.
70
+ - Prefer `node .claude/ukit/index/resolve-context.mjs ...` for indexed related-file context.
71
+ - Prefer `node .claude/ukit/index/verify-context.mjs ...` for concrete verification lanes.
72
+ - **Do not ask normal contributors to run internal helper commands**; run them yourself or tell them to rerun `ukit install`.
73
+ - Do not ask normal contributors to memorize `ukit doctor`, `ukit diff`, `ukit uninstall`, or `ukit index ...` unless they explicitly need maintainer/debug help.
74
+ - If the workspace needs a refresh, prefer telling them to rerun `ukit install`.
75
+
76
+ ## Skill Quality (maintainer-only)
77
+
78
+ - When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping the change.
70
79
 
71
- ## UKit v1.5.1 Shared Runtime
80
+ ## UKit v{{ukit.version}} Shared Runtime
72
81
 
73
82
  - Shared runtime state lives in `.ukit/storage/`.
74
83
  - Treat `.ukit/storage/config.json` as the source of runtime toggles for compact, token pipeline, router, memory, validation, and Safe Patch behavior.
75
- - Reuse `.ukit/storage/memory/` before asking users to restate prior decisions.
84
+ - Reuse `.ukit/storage/memory/` before asking users to restate decisions.
76
85
  - For non-trivial work, prefer `ukit memory recall "<current task>"` before widening doc reads.
77
- - Reusable runtime cache lives in `.ukit/storage/cache/prompt-cache.json`, `.ukit/storage/cache/compact-history.json`, `.ukit/storage/cache/compact-pressure.json`, `.ukit/storage/cache/output-history.json`, and preserved raw tool outputs under `.ukit/storage/cache/tee/`.
86
+ - Reusable cache/compact/output state lives in `.ukit/storage/cache/prompt-cache.json`, `.ukit/storage/cache/compact-history.json`, `.ukit/storage/cache/compact-pressure.json`, `.ukit/storage/cache/output-history.json`, and preserved raw tool outputs under `.ukit/storage/cache/tee/`.
78
87
  - Shared route memory lives in `.claude/ukit/skill-router-state.json`.
79
- - If shared route state already includes compact `previous-context` or `recent-output` lines, reuse those first before rescanning memory or replaying noisy logs.
88
+ - If shared route state already includes compact `previous-context` or `recent-output`, reuse those first.
80
89
  - If an older repo still has a visible `ukit/` runtime root, rerun `ukit install`; UKit should migrate the shared runtime into hidden `.ukit/` when safe.
81
90
  - Maintainers can inspect runtime state with `ukit status` and `ukit memory export`, but normal teammates should still only need `ukit install`.
82
- - If runtime files are missing/corrupt, tell maintainers to rerun `ukit install`.
91
+ - If runtime files are missing or corrupt, tell maintainers to rerun `ukit install`.
83
92
  - Threshold-based compact pressure is internal orchestration; do not expose it to users.
84
93
  - For Codex Desktop long sessions, UKit can use soft auto-compact handoffs. Default `compact.codexContext.compactTarget=150` means about 150 compact handoff lines (120-150 preferred, hard max 170), not 150 tokens.
85
94
 
86
- ## Handoff Quality Gate — OPT-IN
95
+ ## Safe Patch Protocol
96
+
97
+ - Safe Patch is internal orchestration: normal users still only need `ukit install` and natural language.
98
+ - For risky/shared/large edits, prefer unique current-file anchors over line numbers or stale pasted blocks.
99
+ - Do not silently merge stale specs: if `old_string` is missing or ambiguous, re-read current source and ask whether to apply as-is, adapt, or skip.
100
+ - Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files.
101
+ - Use `node .claude/ukit/index/safe-patch.mjs` internally when normal Edit/Write may normalize bytes or when anchor-based matching is needed.
87
102
 
88
- Activates ONLY when work goes through `docs/AI_HANDOFF/` (user says "execute task TASK-xxx" or target is `docs/AI_HANDOFF/tasks/*.md`). Daily prompts → unchanged lightweight flow, no test-first/reviewer overhead.
103
+ ## Handoff Quality Gate — OPT-IN
89
104
 
90
- In Handoff mode: read `docs/AI_HANDOFF/RULES.md` for the 4-phase spec (Idea+Plan → Create Tasks → Implement+Test → Review+Test), state machine, comment thread, and self-reported model contract. Config: `.ukit/storage/config.json` → `handoff.*`.
105
+ 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.
91
106
 
107
+ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + comment thread + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
92
108
 
93
109
  ## Context + Verification Budget
94
110
 
95
- - **Trivial**: no docs, no index query unless the file target is unclear.
96
- - **Simple**: default to `docs/MEMORY.md` only; pull related files/tests with the resolver.
97
- - **Non-trivial**: read `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
98
- - `docs/STATUS.md`: read for open-ended status/continue prompts or meaningful continuation context; treat stale status as orientation only and verify against source/index.
99
- - `docs/TASKS.md`: read only for queued-task prompts or when status points at queued work; safely clean exact duplicates/completed overflow by default without deleting unfinished human-authored tasks.
100
- - `docs/WORKLOG.md`: only recent, relevant entries for continuation/debugging.
101
- - Follow routed verification policy: targeted first when localized, widen in order for shared/risky scope, ask before blanket broad runs when no related-test evidence exists.
111
+ - **Trivial**: no docs, and no index query unless the file target is unclear.
112
+ - **Simple**: `docs/MEMORY.md` only, plus resolver-selected files/tests.
113
+ - **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
114
+ - `docs/STATUS.md`: use for open-ended status/continue prompts or meaningful continuation context; stale status is orientation only.
115
+ - `docs/TASKS.md`: use only for queued-task prompts or when status points at queued work; safely clean exact duplicates/completed overflow by default without deleting unfinished human-authored tasks.
116
+ - `docs/WORKLOG.md`: only recent relevant entries. Follow the Budget Rules at the top of the file; archive oldest entries to `docs/WORKLOG_ARCHIVE.md` when over limits.
117
+ - Follow routed verification policy: targeted first, widen only when risk/shared scope justifies it, ask before blanket broad runs.
102
118
 
103
119
  ## Living Status Workflow
104
120
 
105
- - `docs/STATUS.md` is compact current state, not a transcript and not source truth.
106
- - When the user asks "what next?", "continue", or "project đang ở đâu?" without a concrete target, use the `next-step` skill and show a freshness cue (fresh / possibly stale / stale / missing).
107
- - Concrete debug/implementation/review prompts beat open-ended wording; use the concrete skill first and only use status as background.
108
- - After meaningful work, use `update-status` to record state, verification, blockers, and next candidates; skip trivial/no-state-change tasks.
121
+ - `docs/STATUS.md` captures compact current state, active work, debug threads, blockers, verification, and next candidates.
122
+ - It is not source truth and must not replace source/index-first investigation.
123
+ - For "what next?" / "continue" prompts without a concrete target, use `next-step` and show a freshness cue before relying on the status file.
124
+ - For concrete debug/implementation/review prompts, keep the concrete workflow primary even if the user asks for an approach or next step.
125
+ - After meaningful work, use `update-status`; skip trivial/no-state-change tasks and avoid transcript-style noise.
109
126
  - `docs/TASKS.md` is a local AI task queue: prefer `Ready for AI` when asked to pick queued work, and clean duplicates/prune `Done Recently` safely when reading/updating it.
110
127
 
111
128
  ## Small-Task Maintainer (internal)
@@ -117,36 +134,78 @@ In Handoff mode: read `docs/AI_HANDOFF/RULES.md` for the 4-phase spec (Idea+Plan
117
134
  - This is optional internal orchestration config from `.ukit/storage/config.json`; never turn it into an end-user workflow.
118
135
  - Always preserve the CoDev priority: quality > safety > speed > token discipline.
119
136
 
120
- ## Subagent Policy (internal only)
137
+ ## Post-Edit Sidecar Review (internal)
121
138
 
122
- - Default to direct execution for trivial/simple work.
123
- - Delegate only when it clearly reduces context bloat or enables useful parallel progress.
139
+ - If routed state's `routeSummary.line` includes a `review=code-reviewer(diff)` segment, a `local-build` or `shared-edit` task qualifies for a non-blocking second opinion — this exists because the daily-flow executor model can miss edge cases.
140
+ - Only launch it once write evidence AND verification evidence already exist for the task (never before; never as a substitute for either).
141
+ - Launch the `code-reviewer` agent (see the harness table under 3-Tier Model Routing) with `REVIEW_TARGET_TYPE=diff`, in the background, on the `smart` tier per `subagents.diffReviewModel`. Do not wait for it — continue and report the task as done using the normal completion rules.
142
+ - Its findings are advisory only: never re-open, block, or delay the already-reported completion on their account. Surface them to the user as a follow-up note if/when they arrive.
143
+ - This is internal orchestration — end users never invoke it directly; `ukit install` plus natural language remains the whole surface. No new commands.
144
+
145
+ ## Selective Subagent Policy (internal only)
146
+
147
+ - Keep direct execution as the default for trivial/simple work.
148
+ - Delegate only when it meaningfully shrinks context or enables useful parallel progress.
124
149
  - Good delegation triggers:
125
150
  - noisy side lanes (broad logs/search/test output)
126
151
  - 3+ independent failures/files/checks
127
152
  - explicit batch/plan execution
128
153
  - broad implementation/debug lanes that can return a concise summary
129
- - If route memory already includes `delegate=<lane>`, treat it as an internal hint after any required indexed-context step.
154
+ - If route memory includes `delegate=<lane>`, treat it as an internal hint after any required indexed-context step.
130
155
  - Do not ask end users to name agents or remember agent commands.
131
156
 
132
- ## Safe Patch Protocol
157
+ ## Adaptive Autonomy
133
158
 
134
- - Safe Patch is internal orchestration: normal users still only need `ukit install` and natural language.
135
- - For risky/shared/large edits, prefer unique current-file anchors over line numbers or stale pasted blocks.
136
- - Do not silently merge stale specs: if `old_string` is missing or ambiguous, re-read current source and ask whether to apply as-is, adapt, or skip.
137
- - Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files.
138
- - Use `node .claude/ukit/index/safe-patch.mjs` internally when normal Edit/Write may normalize bytes or when anchor-based matching is needed.
159
+ - `autonomy.level` in `.ukit/storage/config.json` controls how much UKit acts without asking first: `conservative` (ask more), `balanced` (default), `free-run` (auto-run more).
160
+ - End users should not need to change this; maintainers may tune it per-project.
139
161
 
140
- ## Team Workflow Safety
162
+ ## 3-Tier Model Routing
141
163
 
142
- - Do not teach normal contributors `ukit doctor`, `ukit diff`, `ukit uninstall`, or `ukit index ...` unless they are explicitly debugging UKit itself.
143
- - If the workspace needs a refresh, prefer telling them to rerun `ukit install`.
144
- - Keep scope tight, prefer the smallest correct change set, reuse existing code, and update docs when source changes.
164
+ **Internal orchestration only — end users still just use natural language. No new commands.**
145
165
 
146
- ## Adaptive Autonomy
166
+ UKit routes tasks to one of three model tiers based on task complexity:
147
167
 
148
- - `autonomy.level` in `.ukit/storage/config.json` controls how much UKit acts without asking first: `conservative` (ask more), `balanced` (default), `free-run` (auto-run more).
149
- - End users should not need to change this; maintainers may tune it per-project.
168
+ | Tier | Generic alias | Claude model | Typical tasks |
169
+ |------|--------------|--------------|---------------|
170
+ | lite | `unic-lite` | claude-haiku | Reads, git queries, bash summaries, small doc edits |
171
+ | code | `unic-code` | claude-sonnet | Normal coding, local fixes, shared edits, builds, debugging, impact mapping |
172
+ | smart | `unic-smart` | claude-opus | Release review/audit, and escalated deep reasoning after repeated failure |
173
+
174
+ ### Contract-to-tier mapping
175
+
176
+ | Contract | Tier |
177
+ |----------|------|
178
+ | `tiny-fix` | lite |
179
+ | `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` | code |
180
+ | `review-release` | smart |
181
+
182
+ ### How a tier is actually bound
183
+
184
+ The main session model never changes mid-turn. A tier only takes effect when work is handed to
185
+ an agent whose own definition binds that model:
186
+
187
+ | Harness | Agent definitions | How to launch one |
188
+ |---------|-------------------|-------------------|
189
+ | Claude Code | `.claude/agents/*.md` (`model:` frontmatter) | Agent tool, `subagent_type: "<name>"` |
190
+ | omp | `.omp/agents/*.md` (`model: "@lite"` / `"@code"` / `"@smart"` / `"@vision"`, resolved through `modelRoles` in `.omp/config.yml`) | task-agent `<name>` |
191
+
192
+ When a task's contract maps to a tier other than the current session model, hand it to the
193
+ matching agent instead of doing it inline. Doing everything inline is exactly what makes UKit
194
+ behave as if it only had one model — the tier table above has no effect on its own.
195
+
196
+ ### Escalation rule
197
+
198
+ When the same file or symbol fails `debugLoopThreshold` (default: 2) times in one session, UKit routes the next attempt one tier higher (capped at `smart`). Config: `orchestration.escalation` in `.ukit/storage/config.json`.
199
+
200
+ This is internal orchestration — end users do not need to know about tiers, thresholds, or escalation. The AI handles routing transparently.
201
+
202
+ ### Vision lane (capability, not a cost tier)
203
+
204
+ `unic-vision` is a **capability lane**, not a fourth cost tier — it is orthogonal to lite/code/smart above and never appears as a row in the tier table. `unic-code` and `unic-smart` cannot read images on the UNIC gateway; they must never guess at image contents.
205
+
206
+ - **Gateway detection**: UNIC routing for a Claude Code session is decided ONLY by what changes Claude Code's own outbound endpoint — `ANTHROPIC_BASE_URL` (env var, or the `env.ANTHROPIC_BASE_URL` key in project/home `.claude/settings.json`) containing `unicjsc.com`. Other tools' configs — Codex `config.toml`, Kilo `secrets.json`, or an `OPENAI_BASE_URL` env var — describe a different tool's endpoint entirely and never decide this session's routing.
207
+ - **Enforcement**: every image (pasted, local file path, or URL) must be analysed by the `ukit-vision-analyst` agent running on the vision lane before any related edit happens. `Edit`/`Write` are **hard-blocked** until an analysis receipt exists for every pending image; `Read`/`Grep`/`Glob`/`Bash` stay unblocked so the analyst itself can see the image and write its receipt.
208
+ - This is internal orchestration — end users never invoke a vision command directly; `ukit install` plus natural language remains the whole surface. No new commands.
150
209
 
151
210
  ## Session Start — OpenCode
152
211
 
@@ -155,35 +214,43 @@ At the start of every OpenCode session, before working on the first task:
155
214
  2. Note which skills are installed by scanning `.claude/skills/` (directory listing only); read the full SKILL.md only when a task triggers it.
156
215
  3. For every non-trivial task: run `/ukit-route <task summary>` immediately to get skill + context hints **before** writing any code.
157
216
  4. If the route result points to a skill, read that SKILL.md before acting — do not skip this step.
158
- 5. If `.ukit/storage/config.json` has `router.enabled: true`, prefer the router's output over ad-hoc guessing.
159
-
160
- ## Environment Snapshot
161
-
162
- - Project name: {{project.name}}
163
- - Detected packs: {{project.stack}}
164
- - Frontend detected: {{stack.frontend}}
165
- - Backend API detected: {{stack.backendApi}}
166
- - PostgreSQL detected: {{stack.postgres}}
167
- - Package manager: {{runtime.packageManager}}
217
+ 5. If `.ukit/storage/config.json` has `router.enabled: true`, prefer the router output over ad-hoc guessing.
168
218
 
169
219
  ## Skills
170
220
 
171
221
  - Canonical skills live in `.claude/skills/`.
172
- - Adapter mirrors may also exist, for example `.codex/skills/` → `.claude/skills/` (symlink) and `.antigravity/skills/`.
173
- - **OpenCode**: reads `AGENTS.md` at session start only — it does NOT auto-load `.claude/skills/`. The model must explicitly read the triggered SKILL.md (see Session Start section above).
222
+ - Adapter mirrors may also exist, for example `.codex/skills/` → `.claude/skills/` (symlink). **omp** has no mirror: it reads `.claude/skills/` directly through its own `claude` discovery provider.
223
+ - **OpenCode**: reads `AGENTS.md` at session start only — it does NOT auto-load `.claude/skills/`. The model must explicitly read the triggered SKILL.md.
174
224
  - If `opencode.json` ships `ukit-*` commands, treat them as internal helper entrypoints only and **never ask end users to run them**; humans should still only need `ukit install`.
175
225
 
226
+ ## Project Snapshot
227
+
228
+ - Project: {{project.name}} | Root: {{project.root}}
229
+ - Packs: {{project.stack}} | Frontend: {{stack.frontend}} | Backend API: {{stack.backendApi}} | PostgreSQL: {{stack.postgres}}
230
+ - Package manager: {{runtime.packageManager}} | OS: {{runtime.os}} | Node: {{runtime.nodeVersion}} | Provider: {{providers.unic}}
231
+
232
+ ## Working Rules
233
+
234
+ - Keep scope tight, prefer the smallest correct change set, and reuse existing code.
235
+ - For explicit implement/apply/fix requests, keep working until the actual edit is made or a real blocker is found; do not stop after a read-only inspection step.
236
+ - If routed state still says `pull-indexed-context`, treat it as an internal continuation step, not a stopping point.
237
+ - If routed state shows `continuation required` or a stuck-lane rescue mode, finish the named milestone before widening reads or rephrasing the same partial status.
238
+ - Never claim "done", "applied", or "fixed" after Read/Grep/analysis alone. Completion language requires concrete Edit/Write evidence in the current turn, plus verification when the change is risky.
239
+ - Update `docs/WORKLOG.md` after significant work.
240
+ - If source contradicts docs, update docs immediately.
241
+ - Use `{{runtime.packageManager}}`.
242
+
176
243
  ## DuraOne Skill — Conditional Activation
177
244
 
178
245
  DuraOne skill chỉ active khi pack `duraone` được cài hoặc `.claude/skills/duraone/SKILL.md` tồn tại.
179
246
 
180
- - Khi active: đọc `.claude/skills/duraone/SKILL.md` trước khi code.
247
+ - Khi active: luôn đọc `.claude/skills/duraone/SKILL.md` trước khi code.
181
248
  - References:
182
249
  - `.claude/skills/duraone/references/frontend.md`
183
250
  - `.claude/skills/duraone/references/backend.md`
184
251
  - `.claude/skills/duraone/references/sql.md`
185
252
  - `.claude/skills/duraone/references/workflow.md`
186
- - Khi không active: dùng generic coding standards + project patterns từ index.
253
+ - Khi không active: dùng generic coding standards + project-specific patterns từ index.
187
254
 
188
255
  ## Completion Checklist
189
256
 
@@ -191,3 +258,4 @@ DuraOne skill chỉ active khi pack `duraone` được cài hoặc `.claude/skil
191
258
  - No unrelated changes
192
259
  - Verification executed and reported
193
260
  - Docs updated when source truth changed
261
+ {{codegraphSection}}
@@ -3,15 +3,19 @@
3
3
  ## Core Rule
4
4
 
5
5
  - Human-facing UKit workflow should collapse to one remembered command: `ukit install`.
6
- - After install, default to natural-language work inside Claude/Codex.
6
+ - After install, default to natural-language work inside **Claude Code / Codex / OpenCode / omp**.
7
7
  - **Quality first, then speed, then token discipline.**
8
8
  - **Never stop after read-only steps.** For implement/apply/fix requests, continue to actual Edit/Write and verification in the same turn.
9
9
 
10
10
  ## Fast Classification
11
11
 
12
- - **Trivial**: act directly, no doc reads, no agents.
13
- - **Simple**: keep scope tight; use the smallest useful context.
14
- - **Non-trivial / Risky**: read deeper, verify harder, and avoid shortcuts.
12
+ - **Trivial** — typo, label, small rename, spacing, toggle flag, obvious config change.
13
+ - Act directly. No doc reads. No planning. No index. No agents.
14
+ - **Simple** — 1-2 files, clear scope, existing pattern.
15
+ - Handle directly. Pull only the smallest useful context via resolver or targeted read.
16
+ - **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss.
17
+ - Read deeper, verify harder, and avoid shortcuts.
18
+ - Use index-first loop, then skill activation, then targeted verification.
15
19
 
16
20
  ## Execution Contract (mandatory)
17
21
 
@@ -33,6 +37,7 @@ For any task that needs code context:
33
37
  3. For bug signatures:
34
38
  - `node .claude/ukit/index/triage.mjs "<error signature>"`
35
39
  4. Open only the **top 1-3 suspect files first**, then widen if needed.
40
+ 5. For analog/reuse patterns, check if `resolve-context` returns related existing patterns.
36
41
 
37
42
  For clearly non-code specialist lanes (docs-only, status, task queue), skip the source-code index.
38
43
 
@@ -40,8 +45,9 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
40
45
 
41
46
  - End users should not need to know skill names.
42
47
  - On every non-trivial task — and again after the first relevant tool calls — inspect installed project-local skills and **auto-activate the matching skill immediately**.
43
- - Match from prompt signals plus tool/file evidence.
44
- - Use the smallest useful set.
48
+ - Match from both prompt wording and tool/file evidence.
49
+ - Use the smallest effective set, usually 1-2 skills.
50
+ - If evidence becomes more specific than the original prompt, upgrade the active skill choice immediately.
45
51
  - If docs work is detected, read `.claude/skills/docs-quality/SKILL.md` when present.
46
52
  - Prefer routed context and routed verification over ad-hoc broad reading.
47
53
  - Reuse `.claude/ukit/skill-router-state.json` when it already carries compact route memory.
@@ -49,22 +55,23 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
49
55
 
50
56
  ### Common skill triggers
51
57
 
52
- - review / audit / diff → `.claude/skills/code-review/SKILL.md`
53
- - bug / error / crash / triage → `.claude/skills/debugging-toolkit/SKILL.md`
54
- - test / spec / coverage → `.claude/skills/testing-quality/SKILL.md`
58
+ - review / audit / diff / PR feedback → `.claude/skills/code-review/SKILL.md`
59
+ - bug / error / crash / triage / failing path → `.claude/skills/debugging-toolkit/SKILL.md`
60
+ - test / spec / coverage / fixture → `.claude/skills/testing-quality/SKILL.md`
55
61
  - docs / README / changelog / handoff / editing `docs/` / cleaning `docs/TASKS.md` → `.claude/skills/docs-quality/SKILL.md`
56
62
  - open-ended next step / project status / continue with no concrete target / choose queued task → `.claude/skills/next-step/SKILL.md`
57
63
  - explicit handoff / wrap up / update `docs/STATUS.md` → `.claude/skills/update-status/SKILL.md`
58
- - auth / security / token / permission / validation → `.claude/skills/discover-security/SKILL.md`
59
- - stale workspace / reinstall / cleanup → `.claude/skills/repo-maintenance/SKILL.md`
64
+ - auth / security / token / permission / validation / risky shell-path-delete-db work → `.claude/skills/discover-security/SKILL.md`
65
+ - stale workspace / reinstall / cleanup / maintenance → `.claude/skills/repo-maintenance/SKILL.md`
60
66
 
61
67
  ## Internal Helper Policy
62
68
 
63
- - Prefer `node .claude/ukit/index/route-task.mjs ...` when routing is complex.
69
+ - Prefer `node .claude/ukit/index/route-task.mjs "<prompt>" [--tool-command <cmd>] [--target <file>]` when routing is complex or ambiguous.
64
70
  - Prefer `node .claude/ukit/index/resolve-context.mjs ...` for indexed related-file context.
65
71
  - Prefer `node .claude/ukit/index/verify-context.mjs ...` for concrete verification lanes.
66
72
  - **Do not ask normal contributors to run internal helper commands**; run them yourself or tell them to rerun `ukit install`.
67
73
  - Do not ask normal contributors to memorize `ukit doctor`, `ukit diff`, `ukit uninstall`, or `ukit index ...` unless they explicitly need maintainer/debug help.
74
+ - If the workspace needs a refresh, prefer telling them to rerun `ukit install`.
68
75
 
69
76
  ## Skill Quality (maintainer-only)
70
77
 
@@ -76,11 +83,11 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
76
83
  - Treat `.ukit/storage/config.json` as the source of runtime toggles for compact, token pipeline, router, memory, validation, and Safe Patch behavior.
77
84
  - Reuse `.ukit/storage/memory/` before asking users to restate decisions.
78
85
  - For non-trivial work, prefer `ukit memory recall "<current task>"` before widening doc reads.
79
- - Reusable cache/compact/output state lives in `.ukit/storage/cache/prompt-cache.json`, `.ukit/storage/cache/compact-history.json`, `.ukit/storage/cache/compact-pressure.json`, and `.ukit/storage/cache/output-history.json`.
86
+ - Reusable cache/compact/output state lives in `.ukit/storage/cache/prompt-cache.json`, `.ukit/storage/cache/compact-history.json`, `.ukit/storage/cache/compact-pressure.json`, `.ukit/storage/cache/output-history.json`, and preserved raw tool outputs under `.ukit/storage/cache/tee/`.
80
87
  - Shared route memory lives in `.claude/ukit/skill-router-state.json`.
81
88
  - If shared route state already includes compact `previous-context` or `recent-output`, reuse those first.
82
89
  - If an older repo still has a visible `ukit/` runtime root, rerun `ukit install`; UKit should migrate the shared runtime into hidden `.ukit/` when safe.
83
- - Maintainers can inspect runtime state with `ukit status` and `ukit memory export`.
90
+ - Maintainers can inspect runtime state with `ukit status` and `ukit memory export`, but normal teammates should still only need `ukit install`.
84
91
  - If runtime files are missing or corrupt, tell maintainers to rerun `ukit install`.
85
92
  - Threshold-based compact pressure is internal orchestration; do not expose it to users.
86
93
  - For Codex Desktop long sessions, UKit can use soft auto-compact handoffs. Default `compact.codexContext.compactTarget=150` means about 150 compact handoff lines (120-150 preferred, hard max 170), not 150 tokens.
@@ -99,10 +106,9 @@ CHỈ kích hoạt khi task đi qua `docs/AI_HANDOFF/` (user nói "execute task
99
106
 
100
107
  Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine + comment thread + self-report model. Config: `.ukit/storage/config.json` → `handoff.*`.
101
108
 
102
-
103
109
  ## Context + Verification Budget
104
110
 
105
- - **Trivial**: no docs.
111
+ - **Trivial**: no docs, and no index query unless the file target is unclear.
106
112
  - **Simple**: `docs/MEMORY.md` only, plus resolver-selected files/tests.
107
113
  - **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
108
114
  - `docs/STATUS.md`: use for open-ended status/continue prompts or meaningful continuation context; stale status is orientation only.
@@ -132,7 +138,7 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
132
138
 
133
139
  - If routed state's `routeSummary.line` includes a `review=code-reviewer(diff)` segment, a `local-build` or `shared-edit` task qualifies for a non-blocking second opinion — this exists because the daily-flow executor model can miss edge cases.
134
140
  - Only launch it once write evidence AND verification evidence already exist for the task (never before; never as a substitute for either).
135
- - Launch the `code-reviewer` agent via the Agent tool with `REVIEW_TARGET_TYPE=diff` and `run_in_background: true` (model `unic-smart` per `subagents.diffReviewModel`). Do not wait for it — continue and report the task as done using the normal completion rules.
141
+ - Launch the `code-reviewer` agent (see the harness table under 3-Tier Model Routing) with `REVIEW_TARGET_TYPE=diff`, in the background, on the `smart` tier per `subagents.diffReviewModel`. Do not wait for it — continue and report the task as done using the normal completion rules.
136
142
  - Its findings are advisory only: never re-open, block, or delay the already-reported completion on their account. Surface them to the user as a follow-up note if/when they arrive.
137
143
  - This is internal orchestration — end users never invoke it directly; `ukit install` plus natural language remains the whole surface. No new commands.
138
144
 
@@ -140,8 +146,13 @@ Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+P
140
146
 
141
147
  - Keep direct execution as the default for trivial/simple work.
142
148
  - Delegate only when it meaningfully shrinks context or enables useful parallel progress.
143
- - Good delegation triggers: noisy research/log lanes, 3+ independent failures, explicit batch execution, or a broad debug/implementation lane with a clean handoff.
149
+ - Good delegation triggers:
150
+ - noisy side lanes (broad logs/search/test output)
151
+ - 3+ independent failures/files/checks
152
+ - explicit batch/plan execution
153
+ - broad implementation/debug lanes that can return a concise summary
144
154
  - If route memory includes `delegate=<lane>`, treat it as an internal hint after any required indexed-context step.
155
+ - Do not ask end users to name agents or remember agent commands.
145
156
 
146
157
  ## Adaptive Autonomy
147
158
 
@@ -168,6 +179,20 @@ UKit routes tasks to one of three model tiers based on task complexity:
168
179
  | `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` | code |
169
180
  | `review-release` | smart |
170
181
 
182
+ ### How a tier is actually bound
183
+
184
+ The main session model never changes mid-turn. A tier only takes effect when work is handed to
185
+ an agent whose own definition binds that model:
186
+
187
+ | Harness | Agent definitions | How to launch one |
188
+ |---------|-------------------|-------------------|
189
+ | Claude Code | `.claude/agents/*.md` (`model:` frontmatter) | Agent tool, `subagent_type: "<name>"` |
190
+ | omp | `.omp/agents/*.md` (`model: "@lite"` / `"@code"` / `"@smart"` / `"@vision"`, resolved through `modelRoles` in `.omp/config.yml`) | task-agent `<name>` |
191
+
192
+ When a task's contract maps to a tier other than the current session model, hand it to the
193
+ matching agent instead of doing it inline. Doing everything inline is exactly what makes UKit
194
+ behave as if it only had one model — the tier table above has no effect on its own.
195
+
171
196
  ### Escalation rule
172
197
 
173
198
  When the same file or symbol fails `debugLoopThreshold` (default: 2) times in one session, UKit routes the next attempt one tier higher (capped at `smart`). Config: `orchestration.escalation` in `.ukit/storage/config.json`.
@@ -179,9 +204,16 @@ This is internal orchestration — end users do not need to know about tiers, th
179
204
  `unic-vision` is a **capability lane**, not a fourth cost tier — it is orthogonal to lite/code/smart above and never appears as a row in the tier table. `unic-code` and `unic-smart` cannot read images on the UNIC gateway; they must never guess at image contents.
180
205
 
181
206
  - **Gateway detection**: UNIC routing for a Claude Code session is decided ONLY by what changes Claude Code's own outbound endpoint — `ANTHROPIC_BASE_URL` (env var, or the `env.ANTHROPIC_BASE_URL` key in project/home `.claude/settings.json`) containing `unicjsc.com`. Other tools' configs — Codex `config.toml`, Kilo `secrets.json`, or an `OPENAI_BASE_URL` env var — describe a different tool's endpoint entirely and never decide this session's routing.
182
- - **Enforcement**: every image (pasted, local file path, or URL) must be analysed by the `ukit-vision-analyst` agent running on `unic-vision` before any related edit happens. `Edit`/`Write` are **hard-blocked** until an analysis receipt exists for every pending image; `Read`/`Grep`/`Glob`/`Bash` stay unblocked so the analyst itself can see the image and write its receipt.
207
+ - **Enforcement**: every image (pasted, local file path, or URL) must be analysed by the `ukit-vision-analyst` agent running on the vision lane before any related edit happens. `Edit`/`Write` are **hard-blocked** until an analysis receipt exists for every pending image; `Read`/`Grep`/`Glob`/`Bash` stay unblocked so the analyst itself can see the image and write its receipt.
183
208
  - This is internal orchestration — end users never invoke a vision command directly; `ukit install` plus natural language remains the whole surface. No new commands.
184
209
 
210
+ ## Skills
211
+
212
+ - Canonical skills live in `.claude/skills/`.
213
+ - Adapter mirrors may also exist, for example `.codex/skills/` → `.claude/skills/` (symlink). **omp** has no mirror: it reads `.claude/skills/` directly through its own `claude` discovery provider.
214
+ - **OpenCode**: reads `AGENTS.md` at session start only — it does NOT auto-load `.claude/skills/`. The model must explicitly read the triggered SKILL.md.
215
+ - If `opencode.json` ships `ukit-*` commands, treat them as internal helper entrypoints only and **never ask end users to run them**; humans should still only need `ukit install`.
216
+
185
217
  ## Project Snapshot
186
218
 
187
219
  - Project: {{project.name}} | Root: {{project.root}}
@@ -190,8 +222,7 @@ This is internal orchestration — end users do not need to know about tiers, th
190
222
 
191
223
  ## Working Rules
192
224
 
193
- - Keep scope tight.
194
- - Reuse existing code.
225
+ - Keep scope tight, prefer the smallest correct change set, and reuse existing code.
195
226
  - For explicit implement/apply/fix requests, keep working until the actual edit is made or a real blocker is found; do not stop after a read-only inspection step.
196
227
  - If routed state still says `pull-indexed-context`, treat it as an internal continuation step, not a stopping point.
197
228
  - If routed state shows `continuation required` or a stuck-lane rescue mode, finish the named milestone before widening reads or rephrasing the same partial status.
@@ -211,4 +242,11 @@ DuraOne skill chỉ active khi pack `duraone` được cài hoặc `.claude/skil
211
242
  - `.claude/skills/duraone/references/sql.md`
212
243
  - `.claude/skills/duraone/references/workflow.md`
213
244
  - Khi không active: dùng generic coding standards + project-specific patterns từ index.
245
+
246
+ ## Completion Checklist
247
+
248
+ - Requirements implemented
249
+ - No unrelated changes
250
+ - Verification executed and reported
251
+ - Docs updated when source truth changed
214
252
  {{codegraphSection}}
@@ -37,7 +37,7 @@
37
37
  ## Delivery Profile
38
38
 
39
39
  - Primary workflow: natural-language AI tooling installed by UKit
40
- - Shared adapters: Claude Code, OpenAI Codex, Antigravity
40
+ - Shared adapters: Claude Code, OpenAI Codex, OpenCode, omp (Oh My Pi)
41
41
  - Change policy: smallest correct change with clear verification
42
42
 
43
43
  ## Session Start Routine
@@ -53,6 +53,11 @@
53
53
  "mode": "native-auto-prune",
54
54
  "preserveExistingCompaction": true
55
55
  },
56
+ "omp": {
57
+ "autoCompact": true,
58
+ "mode": "precompact-reinject",
59
+ "preserveExistingHooks": true
60
+ },
56
61
  "codex": {
57
62
  "autoCompact": true,
58
63
  "mode": "soft-handoff",
@@ -410,6 +415,11 @@
410
415
  "mode": "native-auto-prune nghĩa là OpenCode dùng compaction.auto/prune native.",
411
416
  "preserveExistingCompaction": "Nên giữ true để không gỡ compact native của OpenCode."
412
417
  },
418
+ "omp": {
419
+ "autoCompact": "Giữ compact lane của omp (Oh My Pi) bật.",
420
+ "mode": "precompact-reinject nghĩa là UKit dùng hook session.compacting/session_before_compact của omp để bơm lại context quan trọng trước khi compact.",
421
+ "preserveExistingHooks": "Nên giữ true để không gỡ các module hooks/pre của bạn khi UKit cài bridge."
422
+ },
413
423
  "codex": {
414
424
  "autoCompact": "Bật policy soft handoff compact cho Codex Desktop.",
415
425
  "mode": "soft-handoff nghĩa là UKit tạo/dùng state tóm tắt, không can thiệp trực tiếp vào internals của app Codex.",
@@ -1,22 +0,0 @@
1
- # {{project.name}}
2
-
3
- Auto-generated by UKit for Google Antigravity.
4
-
5
- - Packs: {{project.stack}}
6
- - Package manager: {{runtime.packageManager}}
7
-
8
- ## Start
9
- Use graduated doc budget:
10
- - Trivial: no docs
11
- - Simple: `docs/MEMORY.md`
12
- - Non-trivial: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`
13
- - `docs/WORKLOG.md`: recent relevant entries only
14
-
15
- If routing is complex/ambiguous, use:
16
- - `node .antigravity/ukit/index/route-task.mjs "<prompt>" [--tool-command <cmd>] [--target <file>]`
17
-
18
- Routing uses natural-language intent (fix/review/brainstorm/build/test/docs).
19
- If confidence is low, ask one short clarifying question.
20
-
21
- ## Skills
22
- Skills are shared from `.claude/skills/` via symlink. Each skill folder contains `SKILL.md`.
@@ -1,49 +0,0 @@
1
- # Project Rules — {{project.name}}
2
-
3
- Auto-generated by UKit. Edit `.claude/` sources to update.
4
-
5
- ## Core policy
6
-
7
- - Natural language only; do not require slash commands or skill names.
8
- - If helper/index commands are needed, run them internally and never ask users to run them.
9
- - Quality first, keep latency low, avoid repeated token waste.
10
- - Reuse shared route state from `.claude/ukit/skill-router-state.json`. If it already carries compact `previous-context` or `recent-output` lines, use those before widening docs, memory, or raw logs.
11
- - Shared runtime lives in `.ukit/storage/`. Reuse `.ukit/storage/memory/`, `.ukit/storage/cache/compact-pressure.json`, `.ukit/storage/cache/output-history.json`, and `.ukit/storage/cache/tee/` before asking users to restate context.
12
-
13
- ## Route fast
14
-
15
- - `fix/bug/error/debug/lỗi/sửa` → fix lane
16
- - `review/audit/check/soát code` → review lane
17
- - `brainstorm/idea/design/plan` → design lane
18
- - `build/implement/add/create` → build lane
19
- - `clone/copy/similar/giống/tương tự` → follow-pattern lane
20
- - `test/spec/coverage` → test lane
21
- - `docs/readme/changelog/tài liệu` → docs lane
22
- - If intent is ambiguous, ask one short clarifying question.
23
- - If routing is complex or shared route memory needs refresh, run `node .antigravity/ukit/index/route-task.mjs "<prompt>" [--tool-command <cmd>] [--target <file>]`.
24
-
25
- ## Skill + context loop
26
-
27
- - Auto-activate the smallest useful installed skill set from prompt + tool/file evidence.
28
- - Prefer `node .antigravity/ukit/index/resolve-context.mjs "<intent>" [--target <file>]` after choosing a skill.
29
- - Prefer `node .antigravity/ukit/index/verify-context.mjs "<intent>" [--target <file>]` for verification planning.
30
-
31
- ## Indexed reading + verification
32
-
33
- - Trivial: no docs, 1-2 files, minimal verify.
34
- - Simple: `docs/MEMORY.md` only, 2-5 files, targeted verify.
35
- - Non-trivial/risky: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`, broader verify.
36
- - `docs/WORKLOG.md`: recent relevant entries only.
37
- - Clone/follow-pattern: open at least 1 analog file.
38
- - Shared logic: open the shared abstraction.
39
- - Bug with tests: open related test first.
40
- - If broad verification is blocked because targeted verification was skipped, go back to the routed targeted lane first.
41
- - For bugfix tasks, run index-first triage: `node .antigravity/ukit/index/build-index.mjs` then `node .antigravity/ukit/index/triage.mjs "<error signature>"`, inspect top suspects, then widen only if needed.
42
-
43
- ## Safety
44
-
45
- - Package manager: `{{runtime.packageManager}}`.
46
- - Keep scope tight and prefer existing code paths.
47
- - Update `docs/WORKLOG.md`, `docs/MEMORY.md`, `docs/CODE_MAP.md`, or `docs/PROJECT.md` after significant work when relevant.
48
- - Never edit `.env*`, lock files, `.git/`, or `node_modules/`.
49
- - Never run destructive commands without explicit confirmation.