Skip to content

chore(claude): distill session experience into agent assets; drop dead opsx commands and stale release skill - #184

Merged
wangrh0909 merged 4 commits into
masterfrom
chore/claude-experience-distillation
Sep 10, 2026
Merged

wangrh0909 merged 4 commits into
masterfrom
chore/claude-experience-distillation

Conversation

@voidvec

@voidvec voidvec commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

Consolidates the recurring lessons from the 2026-08/09 engineering sessions (previously available only in AI-session memory, re-derived and re-hit every few weeks) into versioned repo assets under .claude/, which is the repo's single source of truth for agent guidance. Also removes dead/superseded assets and repairs two broken hooks in .claude/settings.json.

.claude/ is chosen as the authoritative home over a new directory: it is the format with the widest project-level compatibility (Claude Code native; opencode and Cursor read .claude/skills too), and cross-tool agents (CodeBuddy, Qoder, ZCode) already consume this repo through the root AGENTS.md index, which this PR extends.

What's added (8 skills / 3 rules / 2 commands / 3 hook scripts)

Skills (knowledge + policies):

  • ci-gate-sync - sync-point policies when touching error codes / endpoints / migrations / public headers (8-point error-code, 5-point endpoint checklists; api-diff ADDITIVE-vs-BREAKING policy; oasdiff single-line exact-prefix exemption rules; reusable-workflow permission ceiling)
  • ci-failure-triage - cross-compiler WERROR blind-spot matrix, flake vs defect triage, gcov CWD root cause, conan.lock cross-platform discipline, ERESOLVE false-red identification
  • release-engineering - six-point version sync + ~15 secondary carriers, three-gate preflight, tag delete/re-push recovery, release-object-before-tag retirement order, PyPI first-publish token rules, all-English release notes policy (supersedes the deleted release skill)
  • pr-workflow - rebase-and-merge conventions, conflict repair via cherry-pick + patch-id audit, rebase value-loss audit, gh PAT permission boundary, issue triage three-way split
  • local-env-runbook - Windows/WSL/Docker environment runbook (Redis zombie detection, port 5555 mutual exclusion, Mimosa hook workarounds, MSYS path mangling, multi-session ownership rules)
  • test-methodology - two test layers (ctest in-process + 59/52 endpoint scripts), mock injection seam keepAlive pattern, Playwright pitfalls, flake vs isolation-defect classification
  • benchmark-methodology - wrk Lua threading model, A/B discipline (negative control + re-run arm), measurement-artifact taxonomy, honest-claims red lines
  • deployment-runbook - .env.docker.dev/.prod consumption matrix, production startup validation, five-step WSL prod staging (hosts aliases + self-signed CA into the WSL trust store so the 59/52 endpoint scripts run the full nginx chain), server migration flow

Rules (path-scoped, indexed from AGENTS.md): sync-points.md, frontend-contract.md, async-cpp-gotchas.md

Commands: /preflight (local gate sweep before pushing), /ci-triage (failure classification workflow)

Hook scripts (hooks/): local-gates.sh (the five python/bash gates, wired to the git-commit PreToolUse hook), port-guard.sh, redis-watchdog.ps1

What's removed / fixed

  • Removed: commands/opsx/ (OpenSpec workflow for a directory this repo does not have; zero usage), skills/release/ (v1.0.1-era knowledge, missing the six-point sync surface and tag recovery procedure that cost the v1.4.0/v1.0.0 releases)
  • Fixed settings.json: the pre-commit hook pointed at a nonexistent build/tests directory and would block every Claude Code commit with "Build directory not found"; it now runs the fast local-gates.sh sweep. The clang-format PostToolUse hook now formats only the edited file instead of every tracked C++ file on each edit.
  • Fixed stale facts: endpoint test counts 37/17 -> 52/59 in dev-workflow.md; password hashing described as PBKDF2-SHA256 310k in project-conventions; test naming pattern aligned with the enforced P-priority form
  • CODEBUDDY.md: dropped the inaccurate claim that .claude/rules auto-loads in CodeBuddy (Claude Code-only behavior) and the reference to a nonexistent .codebuddy/settings.json

Verification

Out of scope

  • ZCode-local mirrors (.zcode/skills, .zcode/commands) stay untracked per the existing convention for per-tool local workspaces
  • No changes to CI workflows, product code, or docs/

…kill

The opsx commands drive an OpenSpec change workflow for which this repo has
no openspec/ directory and zero recorded usage; drop them. The release skill
reflects v1.0.1-era knowledge (missing the six-point version sync surface and
the tag delete/re-push recovery procedure that broke the v1.4.0 and v1.0.0
releases) and is superseded by the new release-engineering skill.
… and hooks

Consolidates the recurring lessons from the 2026-08/09 engineering sessions
(previously only in AI-session memory) into versioned, tool-agnostic assets:

- skills: ci-gate-sync (sync-point policies for error codes/endpoints/
  migrations/headers), ci-failure-triage (cross-compiler WERROR blind spots,
  flake taxonomy), release-engineering (six-point + ~15 version carriers,
  tag recovery, PyPI first publish), pr-workflow (rebase-merge repair,
  rebase value-loss audit, PAT permission boundary), local-env-runbook
  (Windows/WSL/Docker/Mimosa/multi-session rules), test-methodology (two
  test layers, mock injection seam, Playwright pitfalls), and
  benchmark-methodology (wrk Lua model, A/B discipline, measurement-artifact
  taxonomy).
- rules (path-scoped): sync-points (8-point error-code and 5-point endpoint
  hard checklists), frontend-contract (verified frontend/backend contract
  facts), async-cpp-gotchas (traps beyond db-operations: Session::insert
  no-overwrite, callback double-move, ::drogon:: shadowing).
- commands: /preflight (local gate sweep before pushing), /ci-triage
  (failure classification workflow).
- hooks: local-gates.sh (wired to the git-commit PreToolUse hook, replacing
  the broken full-ctest gate), port-guard.sh, redis-watchdog.ps1.

Provenance (source retrospectives): ci-gate-sync/rules.sync-points from PR
#115/#141/#149/#157/#179/#180 CI post-mortems; release-engineering from the
v1.0.0-v1.1.0 release runs; test-methodology from the coverage push
(48.5%->57.2%) and PR #140/#156 e2e work; benchmark-methodology from the
four-product comparison campaign; local-env-runbook from environment
incident records. AGENTS.md indexes the new rules and skills.
- dev-workflow rule: endpoint test counts 37/17 -> 52/59 (two-year-old
  numbers), direct-run server path now includes the build preset and the
  launch-directory requirement, plus a pointer to the new knowledge skills.
- project-conventions skill: password hashing described as PBKDF2-SHA256
  with 310k iterations (was 'SHA-256 + salt'); test naming pattern updated
  to the enforced P-priority segment form.
- settings.json: the pre-commit hook pointed at a nonexistent build/tests
  directory (would block every Claude Code commit with 'Build directory
  not found') and ran the full ctest suite per commit; it now runs the
  fast local-gates.sh sweep. The clang-format PostToolUse hook now formats
  only the edited file instead of every tracked C++ file.
- CODEBUDDY.md: drop the inaccurate claim that .claude/rules auto-load in
  CodeBuddy (that is Claude Code behavior) and the stale reference to a
  nonexistent .codebuddy/settings.json; state the AGENTS.md-index read
  path instead.
…SL prod staging

Distills the deployment knowledge that previously lived only in session
memory: the .env.docker.dev/.prod consumption matrix (dev compose hardcodes
everything except SMTP; --env-file only interpolates, never injects; the dead
DOMAIN/BOOTSTRAP_ADMIN_PASSWORD variables), production startup validation
(#102) and the dev-seed-must-not-reach-prod rule, the five-step WSL prod
staging procedure (ext4 clone, engine conflict with the dev stack, --build to
bypass the blocked registry, migrate profile, hosts + self-signed CA into the
WSL trust store so the 59/52 endpoint scripts run the full nginx chain), the
fresh-clone server migration flow (no data migration), and the
healthcheck-asymmetry / absolute_redirect / compose-project-name triage notes.
dev-workflow.md indexes the new skill.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af7f7607d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .claude/settings.json
{
"type": "command",
"command": "if [ ! -d build/tests ]; then echo 'Build directory not found. Run manage.sh build-backend first.' && exit 1; fi && echo 'Running pre-commit tests...' && cd build/tests && ctest --output-on-failure && echo 'Tests passed, commit allowed' || (echo 'Tests failed, commit blocked' && exit 1)"
"command": "bash .claude/hooks/local-gates.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid blocking every commit on optional SDK generators

This hook now runs the five gates for every git commit, including regen_clients.py --check, which exits nonzero when openapi-python-client or oapi-codegen is not installed. In a normal checkout that has only the backend toolchain (or for an unrelated documentation change), this prevents the agent from committing at all; the nominal no-PyYAML fallback in the governance gate also cannot parse the current OpenAPI file. Make these dependencies part of the hook's bootstrap or reserve the full sweep for explicit preflight/relevant changes.

Useful? React with 👍 / 👎.

3. **前端门**(改过 frontends/** 时,在对应目录):
```bash
npm run build && npx playwright test --reporter=line
# 改了组件双副本/错误码文案时另跑:node ../scripts/check-ui-sync.mjs(repo 根)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Invoke the UI sync checker from the correct directory

Step 3 says frontend checks are run from frontends/admin or frontends/user, but node ../scripts/check-ui-sync.mjs resolves to frontends/scripts/check-ui-sync.mjs, which does not exist. The checker is at the repository-root scripts/check-ui-sync.mjs, so this prescribed follow-up fails whenever a contributor changes duplicated UI components or error messages. Use ../../scripts/check-ui-sync.mjs from an app directory, or explicitly switch back to the repository root.

Useful? React with 👍 / 👎.

2. **WERROR 构建对齐**(改过任何 C++ 时;配置一次后增量跑,注意增量缓存假绿——改过头文件删
对应 .obj 或 `--clean-first`):
```bash
cmake --preset windows-msvc -DFULLA_WERROR=ON && cmake --build build/windows-msvc --config Release

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Select the WERROR preset for the host platform

When /preflight is used on Linux or macOS, this required C++ validation step cannot configure: the windows-msvc preset is conditionally available only on Windows, while the repository has separate linux-release and macos-arm64 presets. As written, non-Windows contributors cannot complete the documented preflight for any C++ change; choose the platform-specific preset or document separate commands.

Useful? React with 👍 / 👎.

@wangrh0909
wangrh0909 merged commit 06eb7b8 into master Sep 10, 2026
9 checks passed
@voidvec
voidvec deleted the chore/claude-experience-distillation branch September 20, 2026 12:43
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.

2 participants