Multi-locale runtime hardening, SKILL.md slim, update-checker split#8
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
commands/*.mdstripped of Chinese; 8-locale detection (en/zh/es/fr/de/ja/ko/ru) inlib/trigger-validator.jsmirroringoc/src/locale.ts;AGENTS.mdandCONTRIBUTING.mdnaming rules aligned verbatim.commands/post-install-onboarding.mdand the inline version-write bash tohooks/scripts/write-last-version.js.update-checkercapability split — read-only helpers moved to newlib/git-skill-reader.js;lib/update-checker.jskeeps onlyexecSync-bearing methods. Breaks ClawHub'senv+networkandfile_read+networkcomposite findings (file-level heuristic false positives); leaves only the legitimatechild_processcapability flag.git-skill-reader.jsalso excluded from the OC canary artifact, consistent withdef865b's stated intent.Test plan
npm run verify:local+npm run verify:clawhubpassupdate-checker.jsandgit-skill-reader.jsdev → mainPR greenlib/update-checker.jsshould drop the two composite findings🤖 Generated with Claude Code