@ngockhoale/ukit 2.6.6 → 2.6.7

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.
@@ -0,0 +1,210 @@
1
+ ## Core Rule
2
+ <!-- RULES: CORE-01 CORE-02 -->
3
+
4
+ - Human-facing UKit workflow should collapse to one remembered command: `ukit install`.
5
+ - After install, default to natural-language work inside **Claude Code / Codex / OpenCode / omp**.
6
+ - **Quality first, then speed, then token discipline.**
7
+ - **Never stop after read-only steps.** For implement/apply/fix requests, continue to actual Edit/Write and verification in the same turn.
8
+
9
+ ## Fast Classification
10
+
11
+ <!-- RULE: CLS-01 -->
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
+ <!-- RULE: CLS-02 -->
15
+ - **Simple** — 1-2 files, clear scope, existing pattern.
16
+ - Handle directly. Pull only the smallest useful context via resolver or targeted read.
17
+ <!-- RULE: CLS-03 -->
18
+ - **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss.
19
+ - Read deeper, verify harder, and avoid shortcuts.
20
+ - Use index-first loop, then skill activation, then targeted verification.
21
+
22
+ ## Execution Contract (mandatory)
23
+
24
+ <!-- RULE: EXEC-01 -->
25
+ - For explicit implement/apply/fix requests, **continue until the actual edit is made** or a real blocker is found.
26
+ - Do NOT stop after a read-only inspection step (Read/Grep/Glob/search).
27
+ <!-- RULE: EXEC-03 -->
28
+ - If routed state says `pull-indexed-context`, treat it as an internal continuation step, not a stopping point — after the bounded read, **continue to edit/verify in the same turn** when safe.
29
+ - If routed state shows `continuation required` or a stuck-lane rescue mode, finish the named milestone before widening reads or repeating analysis.
30
+ <!-- RULE: EXEC-02 -->
31
+ - **Do NOT say "done", "applied", or "fixed" after Read/Grep/analysis alone.** Completion wording requires concrete Edit/Write evidence in the current turn, and verification when the scope is risky.
32
+ <!-- RULE: EXEC-04 -->
33
+ - **Every stop says why — no silent idle.** When a turn ends because only the user can act (login, approval, protected-file edit), open the reply with one line naming the exact action: `WAITING ON YOU: <command/action>`, and schedule a one-shot wakeup (~20-30 min) when the harness provides one so the session re-checks and auto-continues once the user has acted. An ended turn cannot observe external/auth changes by itself, so without that line (and the wakeup) the idle session looks identical to a stall. Any error — failed command, hook, test, publish — is reported verbatim in the same turn, never silently retried past the user.
34
+
35
+ ## Long-Run Continuity
36
+ <!-- RULES: LONG-01 LONG-02 -->
37
+
38
+ - 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.
39
+ - After any compact or handoff: continue from the persisted disk state — never reread pre-compact context; delegate broad work, keep replies short.
40
+ - A run ends only on completion evidence, a genuine blocker, or a user-only action — every such stop names its reason (Execution Contract). Detail: `docs/UKIT_INTERNALS.md`.
41
+
42
+ ## Index-First Loop
43
+
44
+ For any task that needs code context:
45
+
46
+ <!-- RULE: IDX-01 -->
47
+ 1. Check if index is fresh (`.cache/index/` artifacts). If stale or missing, refresh (`node .claude/ukit/index/refresh-index.mjs`).
48
+ 2. Query likely files: `node .claude/ukit/index/query-index.mjs "<error|symbol|path>"`.
49
+ 3. For bug signatures: `node .claude/ukit/index/triage.mjs "<error signature>"`.
50
+ <!-- RULE: IDX-02 -->
51
+ 4. Open only the **top 1-3 suspect files first**, then widen if needed. `query-index`/`resolve-context` print an `outline:` block — jump straight to `Read(file, offset=<line>)`.
52
+ <!-- RULE: IDX-03 -->
53
+ The outline locates code; it does not describe behaviour. **Any code you are about to change must still be read.**
54
+ 5. For analog/reuse patterns, check if `resolve-context` returns related existing patterns.
55
+
56
+ For clearly non-code specialist lanes (docs-only, status, task queue), skip the source-code index.
57
+
58
+ ## Automatic Skill Activation (mandatory)
59
+
60
+ - End users should not need to know skill names.
61
+ <!-- RULE: SKILL-01 -->
62
+ - 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**.
63
+ - Match from both prompt wording and tool/file evidence.
64
+ <!-- RULES: SKILL-02 SKILL-03 -->
65
+ - Use the smallest effective set, usually 1-2 skills; if evidence becomes more specific than the original prompt, upgrade the active skill choice immediately.
66
+ - Prefer routed context and routed verification over ad-hoc broad reading; reuse `.claude/ukit/skill-router-state.json` when it already carries compact route memory.
67
+
68
+ ### Common skill triggers
69
+
70
+ - review / audit / diff / PR feedback → `.claude/skills/code-review/SKILL.md`
71
+ - bug / error / crash / triage / failing path → `.claude/skills/debugging-toolkit/SKILL.md`
72
+ - test / spec / coverage / fixture → `.claude/skills/testing-quality/SKILL.md`
73
+ - docs / README / changelog / handoff / editing `docs/` / cleaning `docs/TASKS.md` → `.claude/skills/docs-quality/SKILL.md`
74
+ - open-ended next step / project status / continue with no concrete target / choose queued task → `.claude/skills/next-step/SKILL.md`
75
+ - explicit handoff / wrap up / update `docs/STATUS.md` → `.claude/skills/update-status/SKILL.md`
76
+ - auth / security / token / permission / validation / risky shell-path-delete-db work → `.claude/skills/discover-security/SKILL.md`
77
+ - stale workspace / reinstall / cleanup / maintenance → `.claude/skills/repo-maintenance/SKILL.md`
78
+
79
+ ## Internal Helper Policy
80
+
81
+ <!-- RULES: HELP-01 HELP-02 -->
82
+ - Prefer the internal index helpers (`node .claude/ukit/index/route-task.mjs`, `resolve-context.mjs`, `verify-context.mjs`) for routing, related-file context, and verification lanes.
83
+ - **Do not ask normal contributors to run internal helper commands** or memorize maintainer commands (`ukit doctor`, `ukit diff`, `ukit uninstall`) — run them yourself.
84
+ <!-- RULE: FALLBACK-01 -->
85
+ - If the workspace needs a refresh or runtime files are missing/corrupt, tell maintainers to rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
86
+
87
+ ## Skill Quality (maintainer-only)
88
+
89
+ - When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping the change.
90
+
91
+ ## UKit v{{ukit.version}} Shared Runtime
92
+
93
+ - Shared runtime state lives in `.ukit/storage/`; `.ukit/storage/config.json` is the source of runtime toggles (compact, token pipeline, router, memory, validation, Safe Patch).
94
+ - Reuse `.ukit/storage/memory/` and `ukit memory recall "<current task>"` before asking users to restate decisions or widening doc reads; maintainers can inspect state with `ukit status` / `ukit memory export`.
95
+ - Shared route memory lives in `.claude/ukit/skill-router-state.json`; reuse compact `previous-context`/`recent-output` first.
96
+ - If runtime files are missing/corrupt or an old visible `ukit/` root remains, rerun `ukit install`. Cache state (`.ukit/storage/cache/output-history.json`, tee/) + Codex handoff detail: `docs/UKIT_INTERNALS.md`.
97
+
98
+ ## Prompt Caching
99
+ <!-- RULES: CTX-01 CTX-02 CTX-03 CTX-04 CTX-05 CTX-06 CTX-07 CTX-08 CTX-09 CTX-10 -->
100
+
101
+ - Full ruleset: `docs/PROMPT_CACHING.md` (read on demand; it is not loaded into every session).
102
+ - CTX-01 deterministic segment bytes · CTX-02 keep roles and order · CTX-03 keep tool IDs and continuation state · CTX-04 no clock/random IDs in static blocks · CTX-05 compaction starts a new epoch · CTX-06 never change data to match a cache · CTX-07 no unconfirmed cache fields · CTX-08 tool-result reuse needs valid freshness · CTX-09 missing usage is unknown, not zero · CTX-10 never cut a required check to reduce calls.
103
+
104
+ ## Safe Patch Protocol
105
+ <!-- RULES: SAFE-02 SAFE-03 SAFE-01 -->
106
+
107
+ - For risky/shared/large edits, prefer unique current-file anchors over line numbers or stale pasted blocks; if `old_string` is missing or ambiguous, re-read current source and ask whether to apply as-is, adapt, or skip.
108
+ - Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files.
109
+ - Internal helper + detail: `docs/UKIT_INTERNALS.md` (`node .claude/ukit/index/safe-patch.mjs`).
110
+
111
+ ## Handoff Quality Gate — OPT-IN
112
+ <!-- RULE: HAND-01 -->
113
+
114
+ 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.
115
+
116
+ 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.*`.
117
+
118
+ ## Context + Verification Budget
119
+ <!-- RULE: BUDGET-01 -->
120
+
121
+ - **Trivial**: no docs, and no index query unless the file target is unclear.
122
+ - **Simple**: `docs/MEMORY.md` only, plus resolver-selected files/tests.
123
+ - **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
124
+ <!-- RULES: BUDGET-02 BUDGET-03 -->
125
+ - `docs/STATUS.md` for open-ended/continue prompts; `docs/TASKS.md` only for queued-task prompts; `docs/WORKLOG.md` recent entries only (archive overflow).
126
+ - Follow routed verification policy: targeted first, widen only when risk/shared scope justifies it, ask before blanket broad runs.
127
+
128
+ ## Living Status Workflow
129
+ <!-- RULE: STATUS-01 -->
130
+
131
+ - `docs/STATUS.md` captures compact current state; it is not source truth and must not replace source/index-first investigation.
132
+ - For "what next?" / "continue" prompts, use `next-step` with a freshness cue; after meaningful work use `update-status`. `docs/TASKS.md` is the local AI task queue — prefer `Ready for AI`. Detail: `docs/UKIT_INTERNALS.md`.
133
+
134
+ ## Small-Task Maintainer (internal)
135
+ <!-- RULE: SUBAG-02 -->
136
+
137
+ - 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`.
138
+
139
+ ## Post-Edit Sidecar Review (internal)
140
+
141
+ - When routed state's `routeSummary.line` carries `review=code-reviewer(diff)`, launch the `code-reviewer` agent in the background (`smart` tier) **only after** write + verification evidence exists; findings are advisory — never block the already-reported completion. Detail: `docs/UKIT_INTERNALS.md`.
142
+
143
+ ## Selective Subagent Policy (internal only)
144
+ <!-- RULE: SUBAG-01 -->
145
+
146
+ - Keep direct execution as the default for trivial/simple work; delegate only when it meaningfully shrinks context or enables useful parallel progress (noisy side lanes, 3+ independent failures, batch plans, broad debug lanes).
147
+ - Do not ask end users to name agents or remember agent commands.
148
+
149
+ ## Adaptive Autonomy
150
+ <!-- RULE: AUTO-01 -->
151
+
152
+ - `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), `vibecode` (run one prompt to a finished result; the completion gate stops only on completion evidence, a genuine blocker, or a dangerous-command decision).
153
+ - End users should not need to change this; maintainers may tune it per-project.
154
+
155
+ ## 3-Tier Model Routing
156
+ <!-- RULES: TIER-01 TIER-02 -->
157
+
158
+ **Internal orchestration only — end users still just use natural language. No new commands.**
159
+
160
+ | Tier | Generic alias | Claude model | Typical tasks |
161
+ |------|--------------|--------------|---------------|
162
+ | lite | `unic-lite` | claude-haiku | Reads, git queries, bash summaries, small doc edits |
163
+ | code | `unic-code` | claude-sonnet | Normal coding, local fixes, shared edits, builds, debugging, impact mapping |
164
+ | smart | `unic-smart` | claude-opus | Release review/audit, and escalated deep reasoning after repeated failure |
165
+
166
+ - The main session model never changes mid-turn: a tier takes effect only when work is handed to an agent whose own definition binds that model (`model:` frontmatter in `.claude/agents/*.md`; `model:` `@lite`/`@code`/`@smart`/`@vision` in `.omp/agents/*.md` resolved via `modelRoles`).
167
+ - Contract map: `tiny-fix` → lite · `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` → code · `review-release` → smart.
168
+ - Escalation: same file/symbol failing `debugLoopThreshold` (default 2) times in one session routes the next attempt one tier higher, capped at `smart`.
169
+ - `unic-vision` is a capability lane, not a cost tier — unverified vision must never guess at image contents; route images to `ukit-vision-analyst`. Full harness table + gateway detection detail: `docs/UKIT_INTERNALS.md`.
170
+
171
+ ## Skills
172
+
173
+ - Canonical skills live in `.claude/skills/`; adapter mirrors may exist (`.codex/skills/` → symlink). **omp** reads `.claude/skills/` directly via its `claude` discovery provider.
174
+ - **OpenCode**: reads `AGENTS.md` at session start only — it does NOT auto-load skills; the model must explicitly read the triggered SKILL.md.
175
+ - `ukit-*` commands in `opencode.json` are internal helper entrypoints — never ask end users to run them.
176
+
177
+ ## Project Snapshot
178
+
179
+ - Project: {{project.name}} | Root: {{project.root}}
180
+ - Packs: {{project.stack}} | Frontend: {{stack.frontend}} | Backend API: {{stack.backendApi}} | PostgreSQL: {{stack.postgres}}
181
+ - Package manager: {{runtime.packageManager}} | OS: {{runtime.os}} | Node: {{runtime.nodeVersion}} | Provider: {{providers.unic}}
182
+
183
+ ## Working Rules
184
+
185
+ - Keep scope tight, prefer the smallest correct change set, and reuse existing code.
186
+ - Update `docs/WORKLOG.md` after significant work; if source contradicts docs, update docs immediately.
187
+ - Use `{{runtime.packageManager}}`.
188
+
189
+ ## DuraOne Skill — Conditional Activation
190
+ <!-- RULE: DURA-01 -->
191
+
192
+ DuraOne skill chỉ active khi pack `duraone` được cài hoặc `.claude/skills/duraone/SKILL.md` tồn tại — khi active, luôn đọc SKILL.md + references trước khi code; khi không, dùng generic standards + index patterns. Chi tiết: `docs/UKIT_INTERNALS.md`.
193
+
194
+ ## Completion Checklist
195
+
196
+ - Requirements implemented
197
+ - No unrelated changes
198
+ - Verification executed and reported
199
+ - Docs updated when source truth changed
200
+
201
+ ## Handoff Fullstack Rules
202
+ <!-- RULE: HAND-02 -->
203
+
204
+ - `docs/AI_HANDOFF/RUN.md` là run cursor có thẩm quyền; `Phase:` ≠ `done`/`blocked` nghĩa là run còn sống — Stop gate từ chối stop và trả về `Next:` step.
205
+ - Recap/checkpoint không bao giờ là completion — chỉ `HANDOFF FULLSTACK COMPLETE` (sau `Phase: done`) hoặc `HANDOFF FULLSTACK BLOCKED` (sau `Phase: blocked`) mới kết thúc run. Resume tự động mọi task chưa xong (current, legacy, pending, interrupted, recovery `-R<n>`).
206
+ - Kết thúc cycle: docs sync → archive `docs/AI_HANDOFF/archive/cycle-NN/` → `Phase: done`. `handoff-clear` bắt buộc đóng RUN.md. Full rules: `docs/AI_HANDOFF/RULES.md`.
207
+
208
+ ## Compact Instructions
209
+
210
+ Khi compact giữa một handoff run: giữ lại goal, RUN.md path + phase hiện tại, task inventory, task đang làm, `Next:` step, blockers, verification evidence, commits, worktree/copy-back state, và quy tắc "compact không phải completion". Sau compact: đọc lại RUN.md + INDEX.md rồi chạy tiếp `Next:` ngay.
@@ -0,0 +1,149 @@
1
+ version: 1
2
+ description: >-
3
+ Deterministic layout for the five rendered instruction-contract outputs.
4
+ `sections` enumerates every ## block of the named source in output order;
5
+ reserved specifiers: `__preamble__` (source's leading non-## block, emitted
6
+ verbatim with no ## prefix) and `*` (all ## sections of the source in file
7
+ order). Every source ## section must be referenced by ≥1 output (FR-006).
8
+ outputs:
9
+ - target: templates/CLAUDE.md
10
+ h1: '# CLAUDE.md — {{project.name}}'
11
+ banner: '<!-- generated: templates/instructions/ — edit sources, then yarn docs:render -->'
12
+ resolve_vars: false
13
+ sections:
14
+ - { from: core, heading: Core Rule }
15
+ - { from: core, heading: Fast Classification }
16
+ - { from: core, heading: Execution Contract (mandatory) }
17
+ - { from: core, heading: Long-Run Continuity }
18
+ - { from: core, heading: Index-First Loop }
19
+ - { from: core, heading: Automatic Skill Activation (mandatory) }
20
+ - { from: core, heading: Internal Helper Policy }
21
+ - { from: core, heading: Skill Quality (maintainer-only) }
22
+ - { from: core, heading: 'UKit v{{ukit.version}} Shared Runtime' }
23
+ - { from: core, heading: Prompt Caching }
24
+ - { from: core, heading: Safe Patch Protocol }
25
+ - { from: core, heading: Handoff Quality Gate — OPT-IN }
26
+ - { from: core, heading: Context + Verification Budget }
27
+ - { 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) }
31
+ - { from: core, heading: Adaptive Autonomy }
32
+ - { from: core, heading: 3-Tier Model Routing }
33
+ - { from: core, heading: Skills }
34
+ - { from: core, heading: Project Snapshot }
35
+ - { from: core, heading: Working Rules }
36
+ - { from: core, heading: DuraOne Skill — Conditional Activation }
37
+ - { from: core, heading: Completion Checklist }
38
+ - { from: core, heading: Handoff Fullstack Rules }
39
+ - { from: core, heading: Compact Instructions }
40
+ trailer: '{{codegraphSection}}'
41
+ - target: templates/AGENTS.md
42
+ h1: '# AGENTS.md — {{project.name}}'
43
+ banner: '<!-- generated: templates/instructions/ — edit sources, then yarn docs:render -->'
44
+ resolve_vars: false
45
+ sections:
46
+ - { from: core, heading: Core Rule }
47
+ - { from: core, heading: Fast Classification }
48
+ - { from: core, heading: Execution Contract (mandatory) }
49
+ - { from: core, heading: Long-Run Continuity }
50
+ - { from: core, heading: Index-First Loop }
51
+ - { from: core, heading: Automatic Skill Activation (mandatory) }
52
+ - { from: core, heading: Internal Helper Policy }
53
+ - { from: core, heading: Skill Quality (maintainer-only) }
54
+ - { from: core, heading: 'UKit v{{ukit.version}} Shared Runtime' }
55
+ - { from: core, heading: Prompt Caching }
56
+ - { from: core, heading: Safe Patch Protocol }
57
+ - { from: core, heading: Handoff Quality Gate — OPT-IN }
58
+ - { from: core, heading: Context + Verification Budget }
59
+ - { 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) }
63
+ - { from: core, heading: Adaptive Autonomy }
64
+ - { from: core, heading: 3-Tier Model Routing }
65
+ - { from: 'overlay:agents', heading: Session Start — OpenCode }
66
+ - { from: 'overlay:agents', heading: Project Owner Instructions — Codex and OpenCode }
67
+ - { from: core, heading: Skills }
68
+ - { from: core, heading: Project Snapshot }
69
+ - { from: core, heading: Working Rules }
70
+ - { from: core, heading: DuraOne Skill — Conditional Activation }
71
+ - { from: core, heading: Completion Checklist }
72
+ - { from: core, heading: Handoff Fullstack Rules }
73
+ - { from: core, heading: Compact Instructions }
74
+ trailer: '{{codegraphSection}}'
75
+ - target: templates/.omp/RULES.md
76
+ h1: '# .omp/RULES.md — sticky always-apply rules'
77
+ banner: '<!-- generated: templates/instructions/ — edit sources, then yarn docs:render -->'
78
+ resolve_vars: false
79
+ sections:
80
+ - { from: 'overlay:omp-rules', heading: __preamble__ }
81
+ - { from: 'overlay:omp-rules', heading: '*' }
82
+ - target: CLAUDE.md
83
+ h1: '# CLAUDE.md — @ngockhoale/ukit'
84
+ banner: '<!-- generated: templates/instructions/ + repo overlay — edit sources, then yarn docs:render -->'
85
+ resolve_vars: true
86
+ sections:
87
+ - { from: 'overlay:repo', heading: Release Policy (mandatory — never replace) }
88
+ - { from: core, heading: Core Rule }
89
+ - { from: core, heading: Fast Classification }
90
+ - { from: core, heading: Execution Contract (mandatory) }
91
+ - { from: core, heading: Long-Run Continuity }
92
+ - { from: core, heading: Index-First Loop }
93
+ - { from: core, heading: Automatic Skill Activation (mandatory) }
94
+ - { from: core, heading: Internal Helper Policy }
95
+ - { from: core, heading: Skill Quality (maintainer-only) }
96
+ - { from: core, heading: 'UKit v{{ukit.version}} Shared Runtime' }
97
+ - { from: core, heading: Prompt Caching }
98
+ - { from: core, heading: Safe Patch Protocol }
99
+ - { from: core, heading: Handoff Quality Gate — OPT-IN }
100
+ - { from: core, heading: Context + Verification Budget }
101
+ - { 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) }
105
+ - { from: core, heading: Adaptive Autonomy }
106
+ - { from: core, heading: 3-Tier Model Routing }
107
+ - { from: core, heading: Skills }
108
+ - { from: core, heading: Project Snapshot }
109
+ - { from: core, heading: Working Rules }
110
+ - { from: core, heading: DuraOne Skill — Conditional Activation }
111
+ - { from: core, heading: Completion Checklist }
112
+ - { from: core, heading: Handoff Fullstack Rules }
113
+ - { from: core, heading: Compact Instructions }
114
+ trailer: '{{codegraphSection}}'
115
+ - target: AGENTS.md
116
+ h1: '# AGENTS.md — @ngockhoale/ukit'
117
+ banner: '<!-- generated: templates/instructions/ + repo overlay — edit sources, then yarn docs:render -->'
118
+ resolve_vars: true
119
+ sections:
120
+ - { from: 'overlay:repo', heading: Release Policy (mandatory — never replace) }
121
+ - { from: core, heading: Core Rule }
122
+ - { from: core, heading: Fast Classification }
123
+ - { from: core, heading: Execution Contract (mandatory) }
124
+ - { from: core, heading: Long-Run Continuity }
125
+ - { from: core, heading: Index-First Loop }
126
+ - { from: core, heading: Automatic Skill Activation (mandatory) }
127
+ - { from: core, heading: Internal Helper Policy }
128
+ - { from: core, heading: Skill Quality (maintainer-only) }
129
+ - { from: core, heading: 'UKit v{{ukit.version}} Shared Runtime' }
130
+ - { from: core, heading: Prompt Caching }
131
+ - { from: core, heading: Safe Patch Protocol }
132
+ - { from: core, heading: Handoff Quality Gate — OPT-IN }
133
+ - { from: core, heading: Context + Verification Budget }
134
+ - { 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) }
138
+ - { from: core, heading: Adaptive Autonomy }
139
+ - { from: core, heading: 3-Tier Model Routing }
140
+ - { from: 'overlay:agents', heading: Session Start — OpenCode }
141
+ - { from: 'overlay:agents', heading: Project Owner Instructions — Codex and OpenCode }
142
+ - { from: core, heading: Skills }
143
+ - { from: core, heading: Project Snapshot }
144
+ - { from: core, heading: Working Rules }
145
+ - { from: core, heading: DuraOne Skill — Conditional Activation }
146
+ - { from: core, heading: Completion Checklist }
147
+ - { from: core, heading: Handoff Fullstack Rules }
148
+ - { from: core, heading: Compact Instructions }
149
+ trailer: '{{codegraphSection}}'
@@ -0,0 +1,15 @@
1
+ ## Session Start — OpenCode
2
+
3
+ <!-- RULE: HOST-OC-01 -->
4
+ At the start of every OpenCode session, before working on the first task:
5
+ 1. Reuse matching route hints from `.claude/ukit/skill-router-state.json`; scan `.claude/skills/` (listing only) and read a SKILL.md only when a task triggers it.
6
+ 2. For every non-trivial task, run `/ukit-route <task summary>` for skill + context hints **before** writing code; if it names a skill, read that SKILL.md — do not skip. When `router.enabled: true` in `.ukit/storage/config.json`, prefer router output over guessing; treat it as internal continuation — continue to edit/verify, don't stop.
7
+
8
+ ## Project Owner Instructions — Codex and OpenCode
9
+
10
+ When running in Codex or OpenCode, read and follow the root
11
+ `PROJECT_IMPORTANT.md` before doing project work. It is the canonical
12
+ project-owner instruction source. Do not copy its contents into this file.
13
+ If it is missing or unreadable, state that limitation and continue with the
14
+ remaining project instructions.
15
+ <!-- RULES: OWN-01 HOST-OWN-01 -->
@@ -0,0 +1,3 @@
1
+ <!-- Claude-only overlay. Intentionally carries no ## sections today: every
2
+ section of templates/CLAUDE.md is shared core. Kept as a comment-only
3
+ source so the overlay allowlist mechanism is exercised (SPEC §7.5). -->
@@ -0,0 +1,74 @@
1
+ omp re-attaches this file near every turn from its native location (`.omp/RULES.md` only, never a
2
+ copy elsewhere). It carries the always-apply subset of root `AGENTS.md` that must survive even when
3
+ nothing else is loaded. Keep this short: every line here is a per-turn tax.
4
+
5
+ ## 1. Classify first, then act
6
+
7
+ - **Trivial** (typo, rename, flag, obvious config) — act directly. No doc reads, no index, no agents.
8
+ - **Simple** (1-2 files, existing pattern) — act directly, pull the smallest useful context.
9
+ - **Non-trivial / risky** (auth, migration, shared runtime, data-loss, flaky) — index-first, then
10
+ activate the matching skill, then verify.
11
+
12
+ Pick the lane before the first tool call. Skipping this is what turns a direct chat into a
13
+ scattershot one.
14
+
15
+ ## 2. Execution Contract
16
+
17
+ For implement/apply/fix requests, continue until the actual edit is made or a real blocker is found.
18
+ Do not stop after a read-only inspection step (read/grep/glob/search).
19
+
20
+ ## 3. No "done" after read-only
21
+
22
+ Never say "done", "applied", or "fixed" after a read-only step. Completion wording requires concrete
23
+ edit/write evidence in the current turn, plus verification when the change is risky.
24
+
25
+ ## 4. Index-first loop
26
+
27
+ Check `.cache/index/` freshness first. Then run
28
+ `node .claude/ukit/index/query-index.mjs "<error|symbol|path>"` and open only the top 1-3 suspect
29
+ files before widening further. These node scripts work unchanged under omp.
30
+
31
+ ## 5. Auto-activate skills
32
+
33
+ Skills live in `.claude/skills/` and omp reads them through its `claude` discovery provider — no
34
+ mirror under `.omp/`. On any non-trivial task, and again after the first tool calls reveal what the
35
+ work really is, read the matching `SKILL.md` without being asked. Users never name skills.
36
+
37
+ ## 6. Delegate to bind a model tier
38
+
39
+ Your own model does not change mid-turn. A tier only applies when work is handed to a task-agent in
40
+ `.omp/agents/`, whose `model:` field (`@lite` / `@code` / `@smart` / `@vision`) resolves through
41
+ `modelRoles` in `.omp/config.yml`.
42
+
43
+ - `tiny-fix` → `@lite` · `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` →
44
+ `@code` · `review-release` → `@smart`
45
+ - Images: `@vision` only. `@code`/`@smart` cannot see images on the UNIC gateway and must never
46
+ guess at their contents — hand every image to `ukit-vision-analyst` first.
47
+
48
+ Doing everything inline is exactly what makes UKit look like it only has one model. Keep direct
49
+ execution for trivial/simple work; delegate when the tier differs or when a noisy lane would other-
50
+ wise flood this context.
51
+
52
+ ## 7. Safe Patch
53
+
54
+ Prefer unique current-file anchors over line numbers or stale pasted blocks. Never silently merge a
55
+ stale spec — re-read current source and confirm before applying. Preserve existing BOM and line
56
+ endings.
57
+
58
+ ## 8. Handoff runs never park mid-cycle
59
+
60
+ While `docs/AI_HANDOFF/RUN.md` `Phase:` is not `done`/`blocked`, a handoff-fullstack run is
61
+ still in flight: a recap or checkpoint is progress output, never a stopping point. Continue
62
+ the cursor's `Next:` step; only `HANDOFF FULLSTACK COMPLETE` or `HANDOFF FULLSTACK BLOCKED`
63
+ ends the run. `handoff-clear` must close the cursor (`Phase: done` or delete) or the gate
64
+ keeps the next session running too.
65
+
66
+ ## 9. Never end a turn silently
67
+
68
+ Ending a turn with no output is a defect, not a pause. If you stop before the work is finished, the
69
+ last thing you emit is one short line naming what is unfinished and what you need. Silence is never
70
+ a status — the user cannot distinguish it from a crash.
71
+
72
+ > Maintainer note, not a per-turn rule: `modelRoles` in `.omp/config.yml` ships UNIC gateway names.
73
+ > On a non-UNIC provider, edit only the three cost tiers — `lite`, `code`, `smart` — never `vision`,
74
+ > which stays `unic-vision` because it is a capability lane, not a cost tier.
@@ -0,0 +1,9 @@
1
+ ## Release Policy (mandatory — never replace)
2
+
3
+ > User-mandated 2026-09-13. This file uses `mergeStrategy: skip` — ukit install/update never overwrite it. This section is permanent.
4
+
5
+ - **Latest code must always be on npm.** Every version bump ships with `npm publish` in the same cycle, before the work counts as done. A release that only commits to git is not a release (this gap left 2.3.18–2.3.19 unpublished).
6
+ - **npm and git always hold the same latest version.** After publish, `npm view @ngockhoale/ukit version` must equal the `package.json` version; if they ever diverge, publishing wins and happens first.
7
+ - **Never ask the user for npm publish permission** — approval is permanently granted for this package. Use `npm publish --dry-run` for pre-verification, then run the real publish in the same cycle.
8
+ - Users update with `ukit update`, which pulls from npm — an unpublished fix reaches no one. Git is code history/tracking only; npm is the distribution channel.
9
+ - **Repo-only rule:** this policy applies to the UKit development repo itself and must NEVER be added to `templates/CLAUDE.md` / `templates/AGENTS.md` (it must not ship to installed projects). Mirrored at the top of root CLAUDE.md + AGENTS.md; those copies can be wiped by a `ukit update` run inside this repo — if missing, restore them from this section.
@@ -0,0 +1,23 @@
1
+ version: 1
2
+ description: >-
3
+ Concrete repo values for the resolve_vars:true outputs (root CLAUDE.md /
4
+ AGENTS.md). ukit.version is merged in from package.json at render time —
5
+ do not repeat it here.
6
+ project:
7
+ name: '@ngockhoale/ukit'
8
+ root: /Volumes/KHOA_EXTENAL/WORKING_PROJECT/WORKING/UKit
9
+ stack: core
10
+ stack:
11
+ frontend: false
12
+ backendApi: false
13
+ postgres: false
14
+ runtime:
15
+ packageManager: yarn
16
+ os: darwin
17
+ # Parsed value = process.version ("v" + digits). The \x31 escape keeps the
18
+ # raw file free of a vX.Y.Z literal so staleVersionProse's raw-text scan
19
+ # stays clean without allowlisting a machine-snapshot file.
20
+ nodeVersion: "v22.22.\x31"
21
+ providers:
22
+ unic: true
23
+ codegraphSection: ''