@ngockhoale/ukit 2.6.7 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/manifests/documentation.yaml +77 -6
- package/manifests/hostCapabilities.yaml +49 -0
- package/manifests/instructionRules.yaml +7 -0
- package/package.json +1 -1
- package/scripts/bench/goldTasks.json +38 -0
- package/scripts/bench/runGold.mjs +220 -0
- package/scripts/index/build-index.mjs +2 -1
- package/scripts/index/query-index.mjs +2 -0
- package/scripts/release/verify-release.mjs +6 -0
- package/src/cli/commands/code.js +182 -0
- package/src/cli/commands/doctor.js +35 -3
- package/src/cli/commands/indexTools.js +107 -1
- package/src/cli/commands/install.js +2 -1
- package/src/cli/commands/memory.js +137 -0
- package/src/cli/index.js +7 -0
- package/src/core/codeintel/analogy.js +197 -0
- package/src/core/codeintel/cochange.js +205 -0
- package/src/core/codeintel/compiler.js +389 -0
- package/src/core/codeintel/diagnostics.js +114 -0
- package/src/core/codeintel/freshness.js +295 -0
- package/src/core/codeintel/graph.js +291 -0
- package/src/core/codeintel/impact.js +274 -0
- package/src/core/codeintel/invalidation.js +150 -0
- package/src/core/codeintel/manifest.js +176 -0
- package/src/core/codeintel/packet.js +147 -0
- package/src/core/codeintel/providers.js +201 -0
- package/src/core/codeintel/retriever.js +418 -0
- package/src/core/codeintel/router.js +149 -0
- package/src/core/codeintel/semanticProvider.js +235 -0
- package/src/core/codeintel/summaries.js +194 -0
- package/src/core/codeintel/vectorProvider.js +213 -0
- package/src/core/docContracts.js +723 -0
- package/src/core/memory/migrate.js +324 -0
- package/src/core/memory/records.js +172 -0
- package/src/core/memory/retrieval.js +161 -11
- package/src/core/memory/store.js +398 -0
- package/src/core/memory/storeV2.js +171 -0
- package/src/core/memory/storeV2Loader.js +22 -0
- package/src/core/runtimeConfig.js +173 -0
- package/src/core/runtimePaths.js +3 -0
- package/src/index/buildIndex.js +29 -0
- package/src/index/paths.js +2 -0
- package/src/index/taskRouting.js +39 -0
- package/templates/.claude/ukit/index/route-task.mjs +40 -0
- package/templates/AGENTS.md +46 -99
- package/templates/CLAUDE.md +46 -99
- package/templates/docs/AI_HANDOFF/tasks/_TEMPLATE.md +5 -0
- package/templates/docs/BUGFIX.md +2 -19
- package/templates/docs/BUG_INDEX.md +43 -0
- package/templates/docs/BUG_METRICS.md +1 -5
- package/templates/docs/BUG_TEMPLATE.md +1 -11
- package/templates/docs/UKIT_INTERNALS.md +4 -0
- package/templates/instructions/core.md +46 -99
- package/templates/ukit/storage/config.json +35 -0
package/templates/AGENTS.md
CHANGED
|
@@ -3,173 +3,130 @@
|
|
|
3
3
|
|
|
4
4
|
## Core Rule
|
|
5
5
|
<!-- RULES: CORE-01 CORE-02 -->
|
|
6
|
-
|
|
7
|
-
- Human-facing UKit workflow should collapse to one remembered command: `ukit install`.
|
|
6
|
+
- Human-facing UKit workflow collapses to one remembered command: `ukit install`.
|
|
8
7
|
- After install, default to natural-language work inside **Claude Code / Codex / OpenCode / omp**.
|
|
9
8
|
- **Quality first, then speed, then token discipline.**
|
|
10
|
-
- **Never stop after read-only steps
|
|
9
|
+
- **Never stop after read-only steps** — implement/apply/fix requests continue to Edit/Write + verification in the same turn.
|
|
11
10
|
|
|
12
11
|
## Fast Classification
|
|
13
|
-
|
|
14
12
|
<!-- RULE: CLS-01 -->
|
|
15
|
-
- **Trivial** — typo, label, small rename, spacing, toggle flag, obvious config change.
|
|
16
|
-
- Act directly. No doc reads. No planning. No index. No agents.
|
|
13
|
+
- **Trivial** — typo, label, small rename, spacing, toggle flag, obvious config change. Act directly. No doc reads, planning, index, or agents.
|
|
17
14
|
<!-- RULE: CLS-02 -->
|
|
18
|
-
- **Simple** — 1-2 files, clear scope, existing pattern.
|
|
19
|
-
- Handle directly. Pull only the smallest useful context via resolver or targeted read.
|
|
15
|
+
- **Simple** — 1-2 files, clear scope, existing pattern. Handle directly; pull only the smallest useful context via resolver or targeted read.
|
|
20
16
|
<!-- RULE: CLS-03 -->
|
|
21
|
-
- **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss.
|
|
22
|
-
- Read deeper, verify harder, and avoid shortcuts.
|
|
23
|
-
- Use index-first loop, then skill activation, then targeted verification.
|
|
17
|
+
- **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss. Read deeper, verify harder; index-first loop → skill activation → targeted verification.
|
|
24
18
|
|
|
25
19
|
## Execution Contract (mandatory)
|
|
26
|
-
|
|
27
20
|
<!-- RULE: EXEC-01 -->
|
|
28
|
-
- For explicit implement/apply/fix requests, **continue until the actual edit is made** or a real blocker is found.
|
|
29
|
-
- Do NOT stop after a read-only inspection step (Read/Grep/Glob/search).
|
|
21
|
+
- For explicit implement/apply/fix requests, **continue until the actual edit is made** or a real blocker is found — never stop after a read-only inspection step.
|
|
30
22
|
<!-- RULE: EXEC-03 -->
|
|
31
|
-
-
|
|
32
|
-
- If routed state shows `continuation required` or a stuck-lane rescue mode, finish the named milestone before widening reads or repeating analysis.
|
|
23
|
+
- Routed states like `pull-indexed-context` or `continuation required` — treat it as an internal continuation step, not a stopping point; finish the named milestone before widening reads.
|
|
33
24
|
<!-- RULE: EXEC-02 -->
|
|
34
|
-
- **Do NOT say "done"
|
|
25
|
+
- **Do NOT say "done"/"applied"/"fixed" after Read/Grep/analysis alone** — completion wording requires concrete Edit/Write evidence this turn, plus verification when scope is risky.
|
|
35
26
|
<!-- RULE: EXEC-04 -->
|
|
36
|
-
- **Every stop says why — no silent idle.**
|
|
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.
|
|
37
28
|
|
|
38
29
|
## Long-Run Continuity
|
|
39
30
|
<!-- RULES: LONG-01 LONG-02 -->
|
|
40
|
-
|
|
41
31
|
- 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.
|
|
42
|
-
- After any compact or handoff: continue from
|
|
43
|
-
- A run ends only on completion evidence, a genuine blocker, or a user-only action — every
|
|
32
|
+
- After any compact or handoff: continue from persisted disk state — never reread pre-compact context; delegate broad work, keep replies short.
|
|
33
|
+
- A run ends only on completion evidence, a genuine blocker, or a user-only action — every stop names its reason. Detail: `docs/UKIT_INTERNALS.md`.
|
|
44
34
|
|
|
45
35
|
## Index-First Loop
|
|
46
|
-
|
|
47
|
-
For any task that needs code context:
|
|
36
|
+
For any task needing code context:
|
|
48
37
|
|
|
49
38
|
<!-- RULE: IDX-01 -->
|
|
50
|
-
1. Check
|
|
51
|
-
2. Query
|
|
52
|
-
3. For bug signatures: `node .claude/ukit/index/triage.mjs "<error signature>"`.
|
|
39
|
+
1. Check the index is fresh (`.cache/index/`); if stale/missing, refresh via `node .claude/ukit/index/refresh-index.mjs`.
|
|
40
|
+
2. Query files: `node .claude/ukit/index/query-index.mjs "<error|symbol|path>"`; bug signatures: `triage.mjs "<error signature>"`.
|
|
53
41
|
<!-- RULE: IDX-02 -->
|
|
54
|
-
|
|
42
|
+
3. Open only the **top 1-3 suspect files first**, then widen if needed — the `outline:` block lets you jump straight to `Read(file, offset=<line>)`.
|
|
55
43
|
<!-- RULE: IDX-03 -->
|
|
56
|
-
The outline locates code; it does not describe behaviour
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
For clearly non-code specialist lanes (docs-only, status, task queue), skip the source-code index.
|
|
44
|
+
The outline locates code; it does not describe behaviour — **any code you are about to change must still be read**.
|
|
45
|
+
4. For analog/reuse patterns, check `resolve-context`. Non-code lanes (docs-only, status, task queue) skip the source-code index.
|
|
60
46
|
|
|
61
47
|
## Automatic Skill Activation (mandatory)
|
|
62
|
-
|
|
63
|
-
- End users should not need to know skill names.
|
|
64
48
|
<!-- RULE: SKILL-01 -->
|
|
65
|
-
- 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
|
|
66
|
-
- Match from both prompt wording and tool/file evidence.
|
|
49
|
+
- 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**; end users should not need skill names. Match from prompt wording and tool/file evidence.
|
|
67
50
|
<!-- RULES: SKILL-02 SKILL-03 -->
|
|
68
|
-
- Use the smallest effective set
|
|
69
|
-
- Prefer routed context
|
|
51
|
+
- Use the smallest effective set (usually 1-2 skills); if evidence sharpens, upgrade the active skill choice immediately.
|
|
52
|
+
- Prefer routed context/verification over ad-hoc broad reading; reuse `.claude/ukit/skill-router-state.json` compact route memory.
|
|
70
53
|
|
|
71
54
|
### Common skill triggers
|
|
72
55
|
|
|
73
|
-
- review / audit / diff / PR feedback →
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
- docs / README / changelog / handoff / editing `docs/` / cleaning `docs/TASKS.md` → `.claude/skills/docs-quality/SKILL.md`
|
|
77
|
-
- open-ended next step / project status / continue with no concrete target / choose queued task → `.claude/skills/next-step/SKILL.md`
|
|
78
|
-
- explicit handoff / wrap up / update `docs/STATUS.md` → `.claude/skills/update-status/SKILL.md`
|
|
79
|
-
- auth / security / token / permission / validation / risky shell-path-delete-db work → `.claude/skills/discover-security/SKILL.md`
|
|
80
|
-
- stale workspace / reinstall / cleanup / maintenance → `.claude/skills/repo-maintenance/SKILL.md`
|
|
56
|
+
- review / audit / diff / PR feedback → `code-review` · bug / error / crash / triage → `debugging-toolkit` · test / spec / coverage / fixture → `testing-quality`
|
|
57
|
+
- docs / README / changelog / handoff / `docs/` edits → `docs-quality` (`.claude/skills/docs-quality/SKILL.md`) · open-ended / status / continue / queued task → `next-step` · wrap up / `docs/STATUS.md` update → `update-status`
|
|
58
|
+
- auth / security / token / permission / risky work → `discover-security` · stale workspace / reinstall / cleanup → `repo-maintenance` (all under `.claude/skills/<name>/SKILL.md`)
|
|
81
59
|
|
|
82
60
|
## Internal Helper Policy
|
|
83
|
-
|
|
84
61
|
<!-- RULES: HELP-01 HELP-02 -->
|
|
85
|
-
- 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
|
|
62
|
+
- 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.
|
|
86
63
|
- **Do not ask normal contributors to run internal helper commands** or memorize maintainer commands (`ukit doctor`, `ukit diff`, `ukit uninstall`) — run them yourself.
|
|
87
64
|
<!-- RULE: FALLBACK-01 -->
|
|
88
|
-
-
|
|
65
|
+
- Missing/corrupt runtime files or stale workspace → tell maintainers to rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
|
|
89
66
|
|
|
90
67
|
## Skill Quality (maintainer-only)
|
|
91
|
-
|
|
92
|
-
- When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping the change.
|
|
68
|
+
- When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping.
|
|
93
69
|
|
|
94
70
|
## UKit v{{ukit.version}} Shared Runtime
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
- Shared route memory lives in `.claude/ukit/skill-router-state.json`; reuse compact `previous-context`/`recent-output` first.
|
|
99
|
-
- 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`.
|
|
71
|
+
- 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`.
|
|
100
74
|
|
|
101
75
|
## Prompt Caching
|
|
102
76
|
<!-- RULES: CTX-01 CTX-02 CTX-03 CTX-04 CTX-05 CTX-06 CTX-07 CTX-08 CTX-09 CTX-10 -->
|
|
103
|
-
|
|
104
|
-
- Full ruleset: `docs/PROMPT_CACHING.md` (read on demand; it is not loaded into every session).
|
|
77
|
+
- Full ruleset: `docs/PROMPT_CACHING.md` (read on demand; not loaded every session).
|
|
105
78
|
- 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.
|
|
106
79
|
|
|
107
80
|
## Safe Patch Protocol
|
|
108
81
|
<!-- RULES: SAFE-02 SAFE-03 SAFE-01 -->
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
- Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files.
|
|
112
|
-
- Internal helper + detail: `docs/UKIT_INTERNALS.md` (`node .claude/ukit/index/safe-patch.mjs`).
|
|
82
|
+
- Risky/shared/large edits: prefer unique current-file anchors over line numbers or stale pasted blocks; if `old_string` is missing/ambiguous, re-read current source and ask whether to apply as-is, adapt, or skip.
|
|
83
|
+
- Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files. Helper: `node .claude/ukit/index/safe-patch.mjs`; detail: `docs/UKIT_INTERNALS.md`.
|
|
113
84
|
|
|
114
85
|
## Handoff Quality Gate — OPT-IN
|
|
115
86
|
<!-- RULE: HAND-01 -->
|
|
116
|
-
|
|
117
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.
|
|
118
88
|
|
|
119
|
-
Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine +
|
|
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.*`.
|
|
120
90
|
|
|
121
91
|
## Context + Verification Budget
|
|
122
92
|
<!-- RULE: BUDGET-01 -->
|
|
123
|
-
|
|
124
|
-
- **Trivial**: no docs, and no index query unless the file target is unclear.
|
|
125
|
-
- **Simple**: `docs/MEMORY.md` only, plus resolver-selected files/tests.
|
|
126
|
-
- **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
|
|
93
|
+
- **Trivial**: no docs, no index query unless the file target is unclear. **Simple**: `docs/MEMORY.md` only + resolver-selected files/tests. **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
|
|
127
94
|
<!-- RULES: BUDGET-02 BUDGET-03 -->
|
|
128
|
-
- `docs/STATUS.md` for open-ended/continue prompts; `docs/TASKS.md` only for queued-task prompts; `docs/WORKLOG.md` recent entries only (archive overflow).
|
|
129
|
-
- Follow routed verification policy: targeted first, widen only when risk/shared scope justifies it, ask before blanket broad runs.
|
|
95
|
+
- `docs/STATUS.md` for open-ended/continue prompts; `docs/TASKS.md` only for queued-task prompts; `docs/WORKLOG.md` recent entries only (archive overflow). Verification: targeted first, widen only on risk/shared scope, ask before blanket broad runs.
|
|
130
96
|
|
|
131
97
|
## Living Status Workflow
|
|
132
98
|
<!-- RULE: STATUS-01 -->
|
|
133
|
-
|
|
134
|
-
- `docs/
|
|
135
|
-
- 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`.
|
|
99
|
+
- `docs/STATUS.md` captures compact current state — not source truth, never replaces source/index-first investigation.
|
|
100
|
+
- "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`.
|
|
136
101
|
|
|
137
102
|
## Small-Task Maintainer (internal)
|
|
138
103
|
<!-- RULE: SUBAG-02 -->
|
|
139
|
-
|
|
140
104
|
- 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`.
|
|
141
105
|
|
|
142
106
|
## Post-Edit Sidecar Review (internal)
|
|
143
|
-
|
|
144
|
-
- 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`.
|
|
107
|
+
- 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`.
|
|
145
108
|
|
|
146
109
|
## Selective Subagent Policy (internal only)
|
|
147
110
|
<!-- RULE: SUBAG-01 -->
|
|
148
|
-
|
|
149
|
-
- 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).
|
|
150
|
-
- Do not ask end users to name agents or remember agent commands.
|
|
111
|
+
- 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.
|
|
151
112
|
|
|
152
113
|
## Adaptive Autonomy
|
|
153
114
|
<!-- RULE: AUTO-01 -->
|
|
154
|
-
|
|
155
|
-
- `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).
|
|
156
|
-
- End users should not need to change this; maintainers may tune it per-project.
|
|
115
|
+
- `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.
|
|
157
116
|
|
|
158
117
|
## 3-Tier Model Routing
|
|
159
118
|
<!-- RULES: TIER-01 TIER-02 -->
|
|
160
|
-
|
|
161
119
|
**Internal orchestration only — end users still just use natural language. No new commands.**
|
|
162
120
|
|
|
163
121
|
| Tier | Generic alias | Claude model | Typical tasks |
|
|
164
122
|
|------|--------------|--------------|---------------|
|
|
165
123
|
| lite | `unic-lite` | claude-haiku | Reads, git queries, bash summaries, small doc edits |
|
|
166
124
|
| code | `unic-code` | claude-sonnet | Normal coding, local fixes, shared edits, builds, debugging, impact mapping |
|
|
167
|
-
| smart | `unic-smart` | claude-opus | Release review/audit,
|
|
125
|
+
| smart | `unic-smart` | claude-opus | Release review/audit, escalated deep reasoning after repeated failure |
|
|
168
126
|
|
|
169
|
-
-
|
|
170
|
-
- Contract map: `tiny-fix` → lite · `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` → code · `review-release` → smart.
|
|
171
|
-
-
|
|
172
|
-
- `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`.
|
|
127
|
+
- A tier takes effect only when work is handed to an agent whose definition binds that model (`model:` frontmatter in `.claude/agents/*.md`; `model:` `@lite`/`@code`/`@smart`/`@vision` in `.omp/agents/*.md` via `modelRoles`) — the main session model never changes mid-turn.
|
|
128
|
+
- Contract map: `tiny-fix` → lite · `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` → code · `review-release` → smart. Escalation: same file/symbol failing `debugLoopThreshold` (default 2) times routes the next attempt one tier higher, capped at `smart`.
|
|
129
|
+
- `unic-vision` is a capability lane, not a cost tier — unverified vision must never guess image contents; route images to `ukit-vision-analyst`. Harness table: `docs/UKIT_INTERNALS.md`.
|
|
173
130
|
|
|
174
131
|
## Session Start — OpenCode
|
|
175
132
|
|
|
@@ -187,43 +144,33 @@ If it is missing or unreadable, state that limitation and continue with the
|
|
|
187
144
|
remaining project instructions.
|
|
188
145
|
<!-- RULES: OWN-01 HOST-OWN-01 -->
|
|
189
146
|
## Skills
|
|
190
|
-
|
|
191
|
-
- Canonical skills live in `.claude/skills/`; adapter mirrors may exist (`.codex/skills/` → symlink). **omp** reads `.claude/skills/` directly via its `claude` discovery provider.
|
|
147
|
+
- Canonical skills live in `.claude/skills/`; adapter mirrors may exist (`.codex/skills/` → symlink). **omp** reads `.claude/skills/` via its `claude` discovery provider.
|
|
192
148
|
- **OpenCode**: reads `AGENTS.md` at session start only — it does NOT auto-load skills; the model must explicitly read the triggered SKILL.md.
|
|
193
149
|
- `ukit-*` commands in `opencode.json` are internal helper entrypoints — never ask end users to run them.
|
|
194
150
|
|
|
195
151
|
## Project Snapshot
|
|
196
|
-
|
|
197
152
|
- Project: {{project.name}} | Root: {{project.root}}
|
|
198
153
|
- Packs: {{project.stack}} | Frontend: {{stack.frontend}} | Backend API: {{stack.backendApi}} | PostgreSQL: {{stack.postgres}}
|
|
199
154
|
- Package manager: {{runtime.packageManager}} | OS: {{runtime.os}} | Node: {{runtime.nodeVersion}} | Provider: {{providers.unic}}
|
|
200
155
|
|
|
201
156
|
## Working Rules
|
|
202
|
-
|
|
203
157
|
- Keep scope tight, prefer the smallest correct change set, and reuse existing code.
|
|
204
158
|
- Update `docs/WORKLOG.md` after significant work; if source contradicts docs, update docs immediately.
|
|
205
159
|
- Use `{{runtime.packageManager}}`.
|
|
206
160
|
|
|
207
161
|
## DuraOne Skill — Conditional Activation
|
|
208
162
|
<!-- RULE: DURA-01 -->
|
|
209
|
-
|
|
210
163
|
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`.
|
|
211
164
|
|
|
212
165
|
## Completion Checklist
|
|
213
|
-
|
|
214
|
-
- Requirements implemented
|
|
215
|
-
- No unrelated changes
|
|
216
|
-
- Verification executed and reported
|
|
217
|
-
- Docs updated when source truth changed
|
|
166
|
+
- Requirements implemented · No unrelated changes · Verification executed and reported · Docs updated when source truth changed.
|
|
218
167
|
|
|
219
168
|
## Handoff Fullstack Rules
|
|
220
169
|
<!-- RULE: HAND-02 -->
|
|
221
|
-
|
|
222
170
|
- `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.
|
|
223
171
|
- 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>`).
|
|
224
172
|
- 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`.
|
|
225
173
|
|
|
226
174
|
## Compact Instructions
|
|
227
|
-
|
|
228
175
|
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.
|
|
229
176
|
{{codegraphSection}}
|
package/templates/CLAUDE.md
CHANGED
|
@@ -3,212 +3,159 @@
|
|
|
3
3
|
|
|
4
4
|
## Core Rule
|
|
5
5
|
<!-- RULES: CORE-01 CORE-02 -->
|
|
6
|
-
|
|
7
|
-
- Human-facing UKit workflow should collapse to one remembered command: `ukit install`.
|
|
6
|
+
- Human-facing UKit workflow collapses to one remembered command: `ukit install`.
|
|
8
7
|
- After install, default to natural-language work inside **Claude Code / Codex / OpenCode / omp**.
|
|
9
8
|
- **Quality first, then speed, then token discipline.**
|
|
10
|
-
- **Never stop after read-only steps
|
|
9
|
+
- **Never stop after read-only steps** — implement/apply/fix requests continue to Edit/Write + verification in the same turn.
|
|
11
10
|
|
|
12
11
|
## Fast Classification
|
|
13
|
-
|
|
14
12
|
<!-- RULE: CLS-01 -->
|
|
15
|
-
- **Trivial** — typo, label, small rename, spacing, toggle flag, obvious config change.
|
|
16
|
-
- Act directly. No doc reads. No planning. No index. No agents.
|
|
13
|
+
- **Trivial** — typo, label, small rename, spacing, toggle flag, obvious config change. Act directly. No doc reads, planning, index, or agents.
|
|
17
14
|
<!-- RULE: CLS-02 -->
|
|
18
|
-
- **Simple** — 1-2 files, clear scope, existing pattern.
|
|
19
|
-
- Handle directly. Pull only the smallest useful context via resolver or targeted read.
|
|
15
|
+
- **Simple** — 1-2 files, clear scope, existing pattern. Handle directly; pull only the smallest useful context via resolver or targeted read.
|
|
20
16
|
<!-- RULE: CLS-03 -->
|
|
21
|
-
- **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss.
|
|
22
|
-
- Read deeper, verify harder, and avoid shortcuts.
|
|
23
|
-
- Use index-first loop, then skill activation, then targeted verification.
|
|
17
|
+
- **Non-trivial / Risky** — auth, security, migration, uninstall, shared runtime, race/flaky, data-loss. Read deeper, verify harder; index-first loop → skill activation → targeted verification.
|
|
24
18
|
|
|
25
19
|
## Execution Contract (mandatory)
|
|
26
|
-
|
|
27
20
|
<!-- RULE: EXEC-01 -->
|
|
28
|
-
- For explicit implement/apply/fix requests, **continue until the actual edit is made** or a real blocker is found.
|
|
29
|
-
- Do NOT stop after a read-only inspection step (Read/Grep/Glob/search).
|
|
21
|
+
- For explicit implement/apply/fix requests, **continue until the actual edit is made** or a real blocker is found — never stop after a read-only inspection step.
|
|
30
22
|
<!-- RULE: EXEC-03 -->
|
|
31
|
-
-
|
|
32
|
-
- If routed state shows `continuation required` or a stuck-lane rescue mode, finish the named milestone before widening reads or repeating analysis.
|
|
23
|
+
- Routed states like `pull-indexed-context` or `continuation required` — treat it as an internal continuation step, not a stopping point; finish the named milestone before widening reads.
|
|
33
24
|
<!-- RULE: EXEC-02 -->
|
|
34
|
-
- **Do NOT say "done"
|
|
25
|
+
- **Do NOT say "done"/"applied"/"fixed" after Read/Grep/analysis alone** — completion wording requires concrete Edit/Write evidence this turn, plus verification when scope is risky.
|
|
35
26
|
<!-- RULE: EXEC-04 -->
|
|
36
|
-
- **Every stop says why — no silent idle.**
|
|
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.
|
|
37
28
|
|
|
38
29
|
## Long-Run Continuity
|
|
39
30
|
<!-- RULES: LONG-01 LONG-02 -->
|
|
40
|
-
|
|
41
31
|
- 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.
|
|
42
|
-
- After any compact or handoff: continue from
|
|
43
|
-
- A run ends only on completion evidence, a genuine blocker, or a user-only action — every
|
|
32
|
+
- After any compact or handoff: continue from persisted disk state — never reread pre-compact context; delegate broad work, keep replies short.
|
|
33
|
+
- A run ends only on completion evidence, a genuine blocker, or a user-only action — every stop names its reason. Detail: `docs/UKIT_INTERNALS.md`.
|
|
44
34
|
|
|
45
35
|
## Index-First Loop
|
|
46
|
-
|
|
47
|
-
For any task that needs code context:
|
|
36
|
+
For any task needing code context:
|
|
48
37
|
|
|
49
38
|
<!-- RULE: IDX-01 -->
|
|
50
|
-
1. Check
|
|
51
|
-
2. Query
|
|
52
|
-
3. For bug signatures: `node .claude/ukit/index/triage.mjs "<error signature>"`.
|
|
39
|
+
1. Check the index is fresh (`.cache/index/`); if stale/missing, refresh via `node .claude/ukit/index/refresh-index.mjs`.
|
|
40
|
+
2. Query files: `node .claude/ukit/index/query-index.mjs "<error|symbol|path>"`; bug signatures: `triage.mjs "<error signature>"`.
|
|
53
41
|
<!-- RULE: IDX-02 -->
|
|
54
|
-
|
|
42
|
+
3. Open only the **top 1-3 suspect files first**, then widen if needed — the `outline:` block lets you jump straight to `Read(file, offset=<line>)`.
|
|
55
43
|
<!-- RULE: IDX-03 -->
|
|
56
|
-
The outline locates code; it does not describe behaviour
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
For clearly non-code specialist lanes (docs-only, status, task queue), skip the source-code index.
|
|
44
|
+
The outline locates code; it does not describe behaviour — **any code you are about to change must still be read**.
|
|
45
|
+
4. For analog/reuse patterns, check `resolve-context`. Non-code lanes (docs-only, status, task queue) skip the source-code index.
|
|
60
46
|
|
|
61
47
|
## Automatic Skill Activation (mandatory)
|
|
62
|
-
|
|
63
|
-
- End users should not need to know skill names.
|
|
64
48
|
<!-- RULE: SKILL-01 -->
|
|
65
|
-
- 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
|
|
66
|
-
- Match from both prompt wording and tool/file evidence.
|
|
49
|
+
- 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**; end users should not need skill names. Match from prompt wording and tool/file evidence.
|
|
67
50
|
<!-- RULES: SKILL-02 SKILL-03 -->
|
|
68
|
-
- Use the smallest effective set
|
|
69
|
-
- Prefer routed context
|
|
51
|
+
- Use the smallest effective set (usually 1-2 skills); if evidence sharpens, upgrade the active skill choice immediately.
|
|
52
|
+
- Prefer routed context/verification over ad-hoc broad reading; reuse `.claude/ukit/skill-router-state.json` compact route memory.
|
|
70
53
|
|
|
71
54
|
### Common skill triggers
|
|
72
55
|
|
|
73
|
-
- review / audit / diff / PR feedback →
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
- docs / README / changelog / handoff / editing `docs/` / cleaning `docs/TASKS.md` → `.claude/skills/docs-quality/SKILL.md`
|
|
77
|
-
- open-ended next step / project status / continue with no concrete target / choose queued task → `.claude/skills/next-step/SKILL.md`
|
|
78
|
-
- explicit handoff / wrap up / update `docs/STATUS.md` → `.claude/skills/update-status/SKILL.md`
|
|
79
|
-
- auth / security / token / permission / validation / risky shell-path-delete-db work → `.claude/skills/discover-security/SKILL.md`
|
|
80
|
-
- stale workspace / reinstall / cleanup / maintenance → `.claude/skills/repo-maintenance/SKILL.md`
|
|
56
|
+
- review / audit / diff / PR feedback → `code-review` · bug / error / crash / triage → `debugging-toolkit` · test / spec / coverage / fixture → `testing-quality`
|
|
57
|
+
- docs / README / changelog / handoff / `docs/` edits → `docs-quality` (`.claude/skills/docs-quality/SKILL.md`) · open-ended / status / continue / queued task → `next-step` · wrap up / `docs/STATUS.md` update → `update-status`
|
|
58
|
+
- auth / security / token / permission / risky work → `discover-security` · stale workspace / reinstall / cleanup → `repo-maintenance` (all under `.claude/skills/<name>/SKILL.md`)
|
|
81
59
|
|
|
82
60
|
## Internal Helper Policy
|
|
83
|
-
|
|
84
61
|
<!-- RULES: HELP-01 HELP-02 -->
|
|
85
|
-
- 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
|
|
62
|
+
- 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.
|
|
86
63
|
- **Do not ask normal contributors to run internal helper commands** or memorize maintainer commands (`ukit doctor`, `ukit diff`, `ukit uninstall`) — run them yourself.
|
|
87
64
|
<!-- RULE: FALLBACK-01 -->
|
|
88
|
-
-
|
|
65
|
+
- Missing/corrupt runtime files or stale workspace → tell maintainers to rerun `ukit install`. Detail: `docs/UKIT_INTERNALS.md`.
|
|
89
66
|
|
|
90
67
|
## Skill Quality (maintainer-only)
|
|
91
|
-
|
|
92
|
-
- When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping the change.
|
|
68
|
+
- When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping.
|
|
93
69
|
|
|
94
70
|
## UKit v{{ukit.version}} Shared Runtime
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
- Shared route memory lives in `.claude/ukit/skill-router-state.json`; reuse compact `previous-context`/`recent-output` first.
|
|
99
|
-
- 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`.
|
|
71
|
+
- 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`.
|
|
100
74
|
|
|
101
75
|
## Prompt Caching
|
|
102
76
|
<!-- RULES: CTX-01 CTX-02 CTX-03 CTX-04 CTX-05 CTX-06 CTX-07 CTX-08 CTX-09 CTX-10 -->
|
|
103
|
-
|
|
104
|
-
- Full ruleset: `docs/PROMPT_CACHING.md` (read on demand; it is not loaded into every session).
|
|
77
|
+
- Full ruleset: `docs/PROMPT_CACHING.md` (read on demand; not loaded every session).
|
|
105
78
|
- 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.
|
|
106
79
|
|
|
107
80
|
## Safe Patch Protocol
|
|
108
81
|
<!-- RULES: SAFE-02 SAFE-03 SAFE-01 -->
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
- Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files.
|
|
112
|
-
- Internal helper + detail: `docs/UKIT_INTERNALS.md` (`node .claude/ukit/index/safe-patch.mjs`).
|
|
82
|
+
- Risky/shared/large edits: prefer unique current-file anchors over line numbers or stale pasted blocks; if `old_string` is missing/ambiguous, re-read current source and ask whether to apply as-is, adapt, or skip.
|
|
83
|
+
- Preserve UTF-8 BOM/no-BOM and LF/CRLF for existing multilingual/user-authored files. Helper: `node .claude/ukit/index/safe-patch.mjs`; detail: `docs/UKIT_INTERNALS.md`.
|
|
113
84
|
|
|
114
85
|
## Handoff Quality Gate — OPT-IN
|
|
115
86
|
<!-- RULE: HAND-01 -->
|
|
116
|
-
|
|
117
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.
|
|
118
88
|
|
|
119
|
-
Khi Handoff mode: đọc `docs/AI_HANDOFF/RULES.md` để biết 4 phase (Idea+Plan → Create Tasks → Implement+Test → Review+Test) + state machine +
|
|
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.*`.
|
|
120
90
|
|
|
121
91
|
## Context + Verification Budget
|
|
122
92
|
<!-- RULE: BUDGET-01 -->
|
|
123
|
-
|
|
124
|
-
- **Trivial**: no docs, and no index query unless the file target is unclear.
|
|
125
|
-
- **Simple**: `docs/MEMORY.md` only, plus resolver-selected files/tests.
|
|
126
|
-
- **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
|
|
93
|
+
- **Trivial**: no docs, no index query unless the file target is unclear. **Simple**: `docs/MEMORY.md` only + resolver-selected files/tests. **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
|
|
127
94
|
<!-- RULES: BUDGET-02 BUDGET-03 -->
|
|
128
|
-
- `docs/STATUS.md` for open-ended/continue prompts; `docs/TASKS.md` only for queued-task prompts; `docs/WORKLOG.md` recent entries only (archive overflow).
|
|
129
|
-
- Follow routed verification policy: targeted first, widen only when risk/shared scope justifies it, ask before blanket broad runs.
|
|
95
|
+
- `docs/STATUS.md` for open-ended/continue prompts; `docs/TASKS.md` only for queued-task prompts; `docs/WORKLOG.md` recent entries only (archive overflow). Verification: targeted first, widen only on risk/shared scope, ask before blanket broad runs.
|
|
130
96
|
|
|
131
97
|
## Living Status Workflow
|
|
132
98
|
<!-- RULE: STATUS-01 -->
|
|
133
|
-
|
|
134
|
-
- `docs/
|
|
135
|
-
- 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`.
|
|
99
|
+
- `docs/STATUS.md` captures compact current state — not source truth, never replaces source/index-first investigation.
|
|
100
|
+
- "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`.
|
|
136
101
|
|
|
137
102
|
## Small-Task Maintainer (internal)
|
|
138
103
|
<!-- RULE: SUBAG-02 -->
|
|
139
|
-
|
|
140
104
|
- 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`.
|
|
141
105
|
|
|
142
106
|
## Post-Edit Sidecar Review (internal)
|
|
143
|
-
|
|
144
|
-
- 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`.
|
|
107
|
+
- 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`.
|
|
145
108
|
|
|
146
109
|
## Selective Subagent Policy (internal only)
|
|
147
110
|
<!-- RULE: SUBAG-01 -->
|
|
148
|
-
|
|
149
|
-
- 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).
|
|
150
|
-
- Do not ask end users to name agents or remember agent commands.
|
|
111
|
+
- 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.
|
|
151
112
|
|
|
152
113
|
## Adaptive Autonomy
|
|
153
114
|
<!-- RULE: AUTO-01 -->
|
|
154
|
-
|
|
155
|
-
- `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).
|
|
156
|
-
- End users should not need to change this; maintainers may tune it per-project.
|
|
115
|
+
- `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.
|
|
157
116
|
|
|
158
117
|
## 3-Tier Model Routing
|
|
159
118
|
<!-- RULES: TIER-01 TIER-02 -->
|
|
160
|
-
|
|
161
119
|
**Internal orchestration only — end users still just use natural language. No new commands.**
|
|
162
120
|
|
|
163
121
|
| Tier | Generic alias | Claude model | Typical tasks |
|
|
164
122
|
|------|--------------|--------------|---------------|
|
|
165
123
|
| lite | `unic-lite` | claude-haiku | Reads, git queries, bash summaries, small doc edits |
|
|
166
124
|
| code | `unic-code` | claude-sonnet | Normal coding, local fixes, shared edits, builds, debugging, impact mapping |
|
|
167
|
-
| smart | `unic-smart` | claude-opus | Release review/audit,
|
|
125
|
+
| smart | `unic-smart` | claude-opus | Release review/audit, escalated deep reasoning after repeated failure |
|
|
168
126
|
|
|
169
|
-
-
|
|
170
|
-
- Contract map: `tiny-fix` → lite · `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` → code · `review-release` → smart.
|
|
171
|
-
-
|
|
172
|
-
- `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`.
|
|
127
|
+
- A tier takes effect only when work is handed to an agent whose definition binds that model (`model:` frontmatter in `.claude/agents/*.md`; `model:` `@lite`/`@code`/`@smart`/`@vision` in `.omp/agents/*.md` via `modelRoles`) — the main session model never changes mid-turn.
|
|
128
|
+
- Contract map: `tiny-fix` → lite · `local-fix`, `local-build`, `shared-edit`, `find-cause`, `map-impact` → code · `review-release` → smart. Escalation: same file/symbol failing `debugLoopThreshold` (default 2) times routes the next attempt one tier higher, capped at `smart`.
|
|
129
|
+
- `unic-vision` is a capability lane, not a cost tier — unverified vision must never guess image contents; route images to `ukit-vision-analyst`. Harness table: `docs/UKIT_INTERNALS.md`.
|
|
173
130
|
|
|
174
131
|
## Skills
|
|
175
|
-
|
|
176
|
-
- Canonical skills live in `.claude/skills/`; adapter mirrors may exist (`.codex/skills/` → symlink). **omp** reads `.claude/skills/` directly via its `claude` discovery provider.
|
|
132
|
+
- Canonical skills live in `.claude/skills/`; adapter mirrors may exist (`.codex/skills/` → symlink). **omp** reads `.claude/skills/` via its `claude` discovery provider.
|
|
177
133
|
- **OpenCode**: reads `AGENTS.md` at session start only — it does NOT auto-load skills; the model must explicitly read the triggered SKILL.md.
|
|
178
134
|
- `ukit-*` commands in `opencode.json` are internal helper entrypoints — never ask end users to run them.
|
|
179
135
|
|
|
180
136
|
## Project Snapshot
|
|
181
|
-
|
|
182
137
|
- Project: {{project.name}} | Root: {{project.root}}
|
|
183
138
|
- Packs: {{project.stack}} | Frontend: {{stack.frontend}} | Backend API: {{stack.backendApi}} | PostgreSQL: {{stack.postgres}}
|
|
184
139
|
- Package manager: {{runtime.packageManager}} | OS: {{runtime.os}} | Node: {{runtime.nodeVersion}} | Provider: {{providers.unic}}
|
|
185
140
|
|
|
186
141
|
## Working Rules
|
|
187
|
-
|
|
188
142
|
- Keep scope tight, prefer the smallest correct change set, and reuse existing code.
|
|
189
143
|
- Update `docs/WORKLOG.md` after significant work; if source contradicts docs, update docs immediately.
|
|
190
144
|
- Use `{{runtime.packageManager}}`.
|
|
191
145
|
|
|
192
146
|
## DuraOne Skill — Conditional Activation
|
|
193
147
|
<!-- RULE: DURA-01 -->
|
|
194
|
-
|
|
195
148
|
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`.
|
|
196
149
|
|
|
197
150
|
## Completion Checklist
|
|
198
|
-
|
|
199
|
-
- Requirements implemented
|
|
200
|
-
- No unrelated changes
|
|
201
|
-
- Verification executed and reported
|
|
202
|
-
- Docs updated when source truth changed
|
|
151
|
+
- Requirements implemented · No unrelated changes · Verification executed and reported · Docs updated when source truth changed.
|
|
203
152
|
|
|
204
153
|
## Handoff Fullstack Rules
|
|
205
154
|
<!-- RULE: HAND-02 -->
|
|
206
|
-
|
|
207
155
|
- `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.
|
|
208
156
|
- 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>`).
|
|
209
157
|
- 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`.
|
|
210
158
|
|
|
211
159
|
## Compact Instructions
|
|
212
|
-
|
|
213
160
|
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.
|
|
214
161
|
{{codegraphSection}}
|
|
@@ -100,4 +100,9 @@ Reply lùn 1 level (####). Ghi rõ "→ @planner" / "→ @executor" / "→ @revi
|
|
|
100
100
|
<!--
|
|
101
101
|
Phase 3 executor append `## Executor Report` BÊN DƯỚI dấu phân cách này.
|
|
102
102
|
Phase 4 reviewer append `## Reviewer Verdict` BÊN DƯỚI Executor Report.
|
|
103
|
+
|
|
104
|
+
Executor Report header contract (REQUIRED — FR-013). The report MUST open with:
|
|
105
|
+
- EXECUTOR_TOOL: <tool> / EXECUTOR_MODEL: <model> / EXECUTOR_SUBAGENT: <agent> / RED_OUTPUT: <excerpt>
|
|
106
|
+
All four fields are mandatory; missing fields fail the `templates` doc-contract
|
|
107
|
+
check (src/core/docContracts.js).
|
|
103
108
|
-->
|
package/templates/docs/BUGFIX.md
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
# Bugfix SOP
|
|
1
|
+
# Bugfix SOP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Giảm thời gian fix bug bằng cách ưu tiên bằng chứng + index codebase trước khi đọc sâu docs/source.
|
|
5
|
-
|
|
6
|
-
## Required Commands
|
|
7
|
-
- `node .claude/ukit/index/build-index.mjs`
|
|
8
|
-
- `node .claude/ukit/index/query-index.mjs "<error|symbol|path>"`
|
|
9
|
-
- `node .claude/ukit/index/triage.mjs "<error signature>"`
|
|
10
|
-
|
|
11
|
-
## Decision Tree
|
|
12
|
-
1. Có repro command rõ ràng -> chạy triage index.
|
|
13
|
-
2. Lane fast: mở tối đa 1-3 suspect files, patch nhỏ, verify test mục tiêu.
|
|
14
|
-
3. Fail 2 vòng 15 phút liên tiếp -> chuyển lane deep.
|
|
15
|
-
4. Lane deep: instrumentation + root-cause tracing trước khi sửa.
|
|
16
|
-
|
|
17
|
-
## Hard Rules
|
|
18
|
-
- Không sửa khi chưa có evidence (failing test / stack trace / logs).
|
|
19
|
-
- Không refactor lớn trong bug ticket.
|
|
20
|
-
- Verify tối thiểu: test fail ban đầu + test liên quan.
|
|
3
|
+
Consolidated into `docs/BUG_INDEX.md` — see section "Bugfix SOP" (DOC-205).
|