Skip to content

Multi-locale runtime hardening, SKILL.md slim, update-checker split#8

Merged
krishna-505 merged 8 commits into
mainfrom
dev
Apr 10, 2026
Merged

Multi-locale runtime hardening, SKILL.md slim, update-checker split#8
krishna-505 merged 8 commits into
mainfrom
dev

Conversation

@krishna-505

Copy link
Copy Markdown
Contributor

Summary

Promote dev to main with the work from #7 plus the follow-up OC canary fixup (6051cf3).

See #7 for the full detail, test plan, and verification notes.

High-level changes

  • Multi-locale runtime alignment — SKILL.md and commands/*.md stripped of Chinese; 8-locale detection (en/zh/es/fr/de/ja/ko/ru) in lib/trigger-validator.js mirroring oc/src/locale.ts; AGENTS.md and CONTRIBUTING.md naming rules aligned verbatim.
  • SKILL.md slim — 333 → 238 lines by extracting Post-Install Onboarding to commands/post-install-onboarding.md and the inline version-write bash to hooks/scripts/write-last-version.js.
  • update-checker capability split — read-only helpers moved to new lib/git-skill-reader.js; lib/update-checker.js keeps only execSync-bearing methods. Breaks ClawHub's env+network and file_read+network composite findings (file-level heuristic false positives); leaves only the legitimate child_process capability flag.
  • OC canary fixupgit-skill-reader.js also excluded from the OC canary artifact, consistent with def865b's stated intent.

Test plan

  • CI on Multi-locale runtime hardening, SKILL.md slim, update-checker split #7 passed (verify-local ubuntu+windows, verify-clawhub, enforce-base-branch)
  • Local npm run verify:local + npm run verify:clawhub pass
  • CC canary bundles both update-checker.js and git-skill-reader.js
  • OC canary strips both
  • CI on this dev → main PR green
  • Next ClawHub canary scan on lib/update-checker.js should drop the two composite findings

🤖 Generated with Claude Code

krishna-505 and others added 8 commits April 10, 2026 23:07
Align SKILL.md and commands/*.md with the "English at rest, locale at
display time" policy from f801608 / 82546a4, which had previously only
been applied to hook scripts and inbox-engine. Claude detects the
session locale and translates user-facing text at display time.

Migrate Git/PR/language rules from AGENTS.md into CONTRIBUTING.md and
delete AGENTS.md. Generalize the rules from Chinese-specific wording
(e.g. "No Chinese comments") to non-Latin / non-English to match the
multi-locale direction established in PR #6.

Drop the Chinese column from SKILL.md's Dimension label mapping — the
OC plugin supports 8 locales, so privileging one in a "canonical" table
was biased. Keep the English canonical labels plus the anti-invention
rule.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the Chinese-only detectLanguage() with the 8-locale detection
algorithm from oc/src/locale.ts (PR #6): script-based Japanese kana /
Hangul / Cyrillic / CJK detection, then Latin keyword heuristics for
es/fr/de, with en fallback. Add normalizeLocale() to handle BCP 47
region codes (zh-CN, en_US, etc.) consistently.

Previously any skill written in Japanese, Korean, Arabic, Russian,
Spanish, French, etc. was misclassified as English, and Japanese with
kanji was misclassified as Chinese because CJK Unified Ideographs are
shared across CJK scripts. evaluateCrossLocale() now produces correct
D2 cross-locale scores for all 8 supported locales.

Also generalize Chinese-specific examples in prompts/improve.md,
prompts/d2-trigger.md, and oc/src/types/openclaw.d.ts to use BCP 47
format with multiple locale examples (en-US, ja-JP, es-ES).

Verified with 12 detectLanguage cases across all locales, 6
normalizeLocale cases, 6 evaluateCrossLocale integration cases, and
the full verify:local suite.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Split lib/update-checker.js: move read-only helpers (path expansion,
FETCH_HEAD mtime, is-git-repo check, local SKILL.md version parsing)
into a new lib/git-skill-reader.js with no child_process.
update-checker.js keeps only the execSync-bearing methods and composes
a GitSkillReader internally.

This breaks ClawHub's two file-level composite findings on
update-checker.js — env+network (process.env.HOME + execSync git fetch)
and file_read+network (fs.readFileSync + execSync) — by removing
process.env and fs.readFileSync from the file that also contains
execSync. Only the legitimate child_process capability flag remains.

Public API (checkAll, getStale, fetchAndCheck, pullUpdate) is
unchanged — inbox-engine.js and commands/skill-update.md require
nothing new.

Kept `git remote get-url origin` as-is (conservative trade-off: avoids
regression for git submodules, worktrees, and insteadOf URL rewrites
that a direct .git/config parser would miss).

Verified: node -c, full verify:local suite (21 JS files), and an
end-to-end smoke test against a real git-init fixture.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reduce SKILL.md from 333 to 238 lines (-28%, ~2K tokens saved per
session) without losing any runtime behavior.

Extract the 85-line Post-Install Onboarding flow into
commands/post-install-onboarding.md. SKILL.md keeps a 5-line pointer
block and session-tracker.js's injected context message now directs
Claude to load the new file instead of hunting through SKILL.md.

Extract the inline node -e bash snippet that records the installed
version into hooks/scripts/write-last-version.js. The new script is
silent on both success and failure (intentional: the onboarding must
complete even if the sidecar cannot be written). Smoke-tested against
a temp fixture for both paths.

Trim verbose Global UX Rules examples in place while keeping all
eight interaction rules intact.

Add Smart Entry boundary fallbacks for empty inventory, missing or
malformed inbox.json, and other unexpected read errors so the
dispatcher degrades gracefully instead of improvising.

Verified: npm run verify:local passes (22 JS files, self-hosting
contracts, static-scan hygiene, pre-eval fixtures, non-git sidecar
hooks, OpenClaw event-flow). Re-ran the D1/D2/D3 local validators
against the refactored SKILL.md — scores unchanged (D1=9, D2=10,
D3=9.5 pass) because these were already near-max; the real benefit
is structural clarity and per-session context savings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Honor the "Source of Truth" clause at the bottom of AGENTS.md by
making its Required Rules bullets byte-identical to the Naming &
Language Conventions section in CONTRIBUTING.md.

AGENTS.md pulls in the examples, phrasing, and extra clarifications
from CONTRIBUTING.md: branch-name examples, the "Use description/body
for details" note on PR titles, "Follow conventional commit format"
wording, and the edge-non-english directory reference for test
fixtures.

CONTRIBUTING.md pulls in the more precise "English only at rest"
wording introduced in AGENTS.md for the user-facing templates rule,
plus backticks around the second SKILL.md reference for formatting
consistency.

No behavior change; pure documentation alignment. Verified that the
seven rule bullets are now byte-identical in the git index.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The e6c4b55 refactor split lib/update-checker.js into update-checker.js
and a new read-only lib/git-skill-reader.js helper. def865b had
added update-checker.js to ocUnsafeSharedFiles so the OC canary
artifact never shipped git fetch/pull capabilities, but that list
is hardcoded and did not know about the new file.

git-skill-reader.js is technically harmless in the OC artifact — it
has no child_process, just fs + process.env for ~ expansion and
FETCH_HEAD mtime reads — so the existing scanner findings and the
OC runtime both stay clean. But def865b's stated goal is "OC runtime
never loads git fetch/pull capabilities", and shipping a file whose
whole purpose is reading local git repo metadata under a fix that
excluded its sibling file is confusing to future readers.

Add it to the exclusion list for consistency with the original intent.
The CC canary still bundles both files; only the OC profile strips
them.

Verified:
- npm run verify:clawhub passes
- CC canary (clawhub-canary-upload/lib/) contains both files
- OC canary (clawhub-oc-canary-upload/lib/) contains neither

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Multi-locale runtime hardening, SKILL.md slim, update-checker split
@krishna-505 krishna-505 merged commit 4af8092 into main Apr 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant