@ngockhoale/ukit 1.6.8 → 2.0.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 (64) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/manifests/platform.full.yaml +47 -0
  3. package/package.json +2 -1
  4. package/scripts/skill/audit-skill.mjs +39 -0
  5. package/src/cli/commands/doctor.js +22 -2
  6. package/src/cli/commands/memory.js +76 -1
  7. package/src/core/memory/store.js +125 -1
  8. package/src/core/skillProfile.js +45 -0
  9. package/src/skill/auditSkill.js +99 -0
  10. package/templates/.claude/agents/code-reviewer.md +51 -7
  11. package/templates/.claude/agents/handoff-planner.md +18 -2
  12. package/templates/.claude/hooks/context-hardcap-gate.sh +102 -0
  13. package/templates/.claude/hooks/reset-compact-pressure.sh +25 -0
  14. package/templates/.claude/settings.json +15 -0
  15. package/templates/.claude/skills/canvas-design/SKILL.md +2 -20
  16. package/templates/.claude/skills/canvas-design/philosophy-examples.md +23 -0
  17. package/templates/.claude/skills/debugging-toolkit/SKILL.md +2 -30
  18. package/templates/.claude/skills/debugging-toolkit/reference-tables.md +33 -0
  19. package/templates/.claude/skills/docs-manager/SKILL.md +7 -249
  20. package/templates/.claude/skills/docs-manager/conventions-and-examples.md +221 -0
  21. package/templates/.claude/skills/docx/SKILL.md +3 -34
  22. package/templates/.claude/skills/docx/redlining-reference.md +34 -0
  23. package/templates/.claude/skills/duraone/SKILL.md +12 -16
  24. package/templates/.claude/skills/executing-plans/SKILL.md +31 -19
  25. package/templates/.claude/skills/file-organizer/SKILL.md +2 -170
  26. package/templates/.claude/skills/file-organizer/examples-and-practices.md +173 -0
  27. package/templates/.claude/skills/pdf/SKILL.md +1 -62
  28. package/templates/.claude/skills/pdf/reference.md +65 -0
  29. package/templates/.claude/skills/pdf-processing-pro/SKILL.md +2 -73
  30. package/templates/.claude/skills/pdf-processing-pro/workflows-and-troubleshooting.md +80 -0
  31. package/templates/.claude/skills/pptx/SKILL.md +14 -286
  32. package/templates/.claude/skills/pptx/design-references.md +81 -0
  33. package/templates/.claude/skills/pptx/template-replacement-reference.md +150 -0
  34. package/templates/.claude/skills/pptx/utilities.md +62 -0
  35. package/templates/.claude/skills/project-learning/SKILL.md +32 -0
  36. package/templates/.claude/skills/root-cause-tracing/SKILL.md +2 -35
  37. package/templates/.claude/skills/root-cause-tracing/diagrams.md +44 -0
  38. package/templates/.claude/skills/sharing-skills/SKILL.md +1 -41
  39. package/templates/.claude/skills/sharing-skills/complete-example.md +41 -0
  40. package/templates/.claude/skills/skill-quality/SKILL.md +37 -0
  41. package/templates/.claude/skills/skill-quality/pressure-scenario-template.md +20 -0
  42. package/templates/.claude/skills/skill-quality/rationalization-table-template.md +15 -0
  43. package/templates/.claude/skills/skill-quality/trigger-accuracy-template.md +32 -0
  44. package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +13 -440
  45. package/templates/.claude/skills/sql-optimization-patterns/references/advanced-techniques.md +128 -0
  46. package/templates/.claude/skills/sql-optimization-patterns/references/core-concepts.md +112 -0
  47. package/templates/.claude/skills/sql-optimization-patterns/references/query-patterns.md +204 -0
  48. package/templates/.claude/skills/subagent-driven-development/SKILL.md +4 -51
  49. package/templates/.claude/skills/subagent-driven-development/example-workflow.md +40 -0
  50. package/templates/.claude/skills/systematic-debugging/SKILL.md +2 -28
  51. package/templates/.claude/skills/systematic-debugging/reference-tables.md +33 -0
  52. package/templates/.claude/skills/test-driven-development/SKILL.md +2 -51
  53. package/templates/.claude/skills/test-driven-development/reference-tables.md +56 -0
  54. package/templates/.claude/skills/testing-anti-patterns/SKILL.md +1 -10
  55. package/templates/.claude/skills/testing-anti-patterns/reference-tables.md +14 -0
  56. package/templates/.claude/skills/verification-before-completion/SKILL.md +1 -31
  57. package/templates/.claude/skills/verification-before-completion/key-patterns.md +33 -0
  58. package/templates/.claude/ukit/runtime/compact-threshold.mjs +28 -0
  59. package/templates/.claude/ukit/runtime/reinject-context.mjs +14 -1
  60. package/templates/CLAUDE.md +4 -0
  61. package/templates/ukit/storage/config.json +4 -0
  62. package/src/core/memory/index.js +0 -2
  63. package/src/core/router/index.js +0 -2
  64. package/src/core/validation/index.js +0 -2
@@ -14,6 +14,8 @@ import {
14
14
  import {
15
15
  buildThresholdCompactPlan,
16
16
  readCompactPressureState,
17
+ resetCompactPressureState,
18
+ writeCompactPressureState,
17
19
  writeThresholdCompactPlan,
18
20
  } from './compact-threshold.mjs';
19
21
 
@@ -62,6 +64,14 @@ async function main() {
62
64
  const rawBodyLines = [...rawStaticLines, ...dynamicLines];
63
65
  const bodyLines = [...staticLines, ...dynamicLines];
64
66
  const pressureState = await readCompactPressureState(projectRoot, config);
67
+
68
+ // Reset the hard-cap tracker as early as possible: this hook fires on every real
69
+ // compaction, and it is the only signal that context actually shrank. It must happen
70
+ // before the promptCache early-return below, otherwise a cache hit would skip it and
71
+ // leave context-hardcap-gate.sh permanently tripped. Downstream writes
72
+ // (writeThresholdCompactPlan) re-read from disk, so they build on the zeroed state and
73
+ // keep their own stats increments intact.
74
+ await writeCompactPressureState(projectRoot, resetCompactPressureState(pressureState, config), config);
65
75
  const anchorLines = dynamicLines.filter((line) => (
66
76
  line.startsWith('- Recent routed lane:')
67
77
  || line.startsWith('- Current approach:')
@@ -93,7 +103,10 @@ async function main() {
93
103
  activeSkills: Array.isArray(state?.activeSkills) ? state.activeSkills.map((item) => getActiveSkillPath(item)) : [],
94
104
  bodyLines: thresholdPlan.active ? thresholdPlan.lines : bodyLines,
95
105
  thresholdPhase: thresholdPlan.active ? thresholdPlan.phase : 'monitor',
96
- estimatedTotalTokens: thresholdPlan.active ? thresholdPlan.estimatedTotalTokens : pressureState.estimatedTotalTokens,
106
+ // Only key on the token count when the threshold plan is active — that is the only case
107
+ // where it changes the rendered output. Keying on the live pressure value while inactive
108
+ // would miss the cache on every run, since the reset above zeroes it between runs.
109
+ estimatedTotalTokens: thresholdPlan.active ? thresholdPlan.estimatedTotalTokens : 0,
97
110
  });
98
111
 
99
112
  if (config.tokenPipeline?.promptCache) {
@@ -66,6 +66,10 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
66
66
  - **Do not ask normal contributors to run internal helper commands**; run them yourself or tell them to rerun `ukit install`.
67
67
  - Do not ask normal contributors to memorize `ukit doctor`, `ukit diff`, `ukit uninstall`, or `ukit index ...` unless they explicitly need maintainer/debug help.
68
68
 
69
+ ## Skill Quality (maintainer-only)
70
+
71
+ - When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping the change.
72
+
69
73
  ## UKit v{{ukit.version}} Shared Runtime
70
74
 
71
75
  - Shared runtime state lives in `.ukit/storage/`.
@@ -9,6 +9,8 @@
9
9
  "compact": {
10
10
  "enabled": true,
11
11
  "tokenThreshold": 50000,
12
+ "hardCapTokens": 220000,
13
+ "hardCapBlock": true,
12
14
  "contextRotDetection": true,
13
15
  "askBeforeDrop": true,
14
16
  "codexContext": {
@@ -367,6 +369,8 @@
367
369
  "compact": {
368
370
  "enabled": "Bật/tắt toàn bộ helper compact của UKit.",
369
371
  "tokenThreshold": "Ngưỡng token chung cho runtime compact dùng chung.",
372
+ "hardCapTokens": "Ngưỡng cứng tuyệt đối (mặc định 220000 token ước lượng). Chạm/vượt ngưỡng này thì context coi như quá dài — không phải gợi ý nữa, là bắt buộc.",
373
+ "hardCapBlock": "Nếu true, hook context-hardcap-gate chặn cứng Edit/Write/Bash (exit 2) khi vượt hardCapTokens, cho tới khi có compact thật (PreCompact) reset lại bộ đếm. Không có ngoại lệ.",
370
374
  "contextRotDetection": "Phát hiện context quá dài/dễ mục để giữ lại state quan trọng trước khi AI nhớ sai.",
371
375
  "askBeforeDrop": "Giữ thái độ thận trọng trước khi bỏ context quan trọng. Nếu rủi ro thì hand back cho main model.",
372
376
  "agentContext": {
@@ -1,2 +0,0 @@
1
- export { detectConflict, runHygiene } from './hygiene.js';
2
- export { expand, getContextInjection, search } from './retrieval.js';
@@ -1,2 +0,0 @@
1
- export { askAdvisor, shouldEscalate } from './advisor.js';
2
- export { classifyTask, detectComplexity, selectModel } from './router.js';
@@ -1,2 +0,0 @@
1
- export { scoreConfidence } from './confidence.js';
2
- export { validateOutput } from './validator.js';