Skip to content

docs: dev-docs/ engineering knowledge base, slimmer CLAUDE.md, enforced Sui-pin consistency#1738

Merged
omersadika merged 7 commits into
devfrom
chore/dev-docs-and-claude-md
Jun 13, 2026
Merged

docs: dev-docs/ engineering knowledge base, slimmer CLAUDE.md, enforced Sui-pin consistency#1738
omersadika merged 7 commits into
devfrom
chore/dev-docs-and-claude-md

Conversation

@omersadika

@omersadika omersadika commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Reorganizes engineering documentation around how AI coding agents (and humans) actually consume it, applies current agentic-coding best practice to CLAUDE.md — converting advisory rules into deterministic enforcement wherever possible — and ships the on-demand tooling (skills, a reviewer subagent, a git-guard hook) that the always-loaded file should not carry.

The design, and the research behind it

  • CLAUDE.md carries only always-applicable rules. Anthropic's Claude Code best practices are explicit: CLAUDE.md is loaded into every session ("For each line, ask: would removing this cause Claude to make mistakes?" — "Bloated CLAUDE.md files cause Claude to ignore your actual instructions"). Deep-dive material moved out behind plain-path pointers (deliberately not @imports, which inline into every session).
  • dev-docs/ is the on-demand knowledge base (docs/ remains the public website), structured per Karpathy's context-engineering framing (definition; agent-legible docs critique: "What is the thing I should copy-paste to my agent?") — playbooks lead with copy-pasteable commands; learnings are compiled into a persistent markdown base.
  • Enforce, don't document: rules a machine can check were moved into machines — clippy.toml already covered six of CLAUDE.md's style rules (now deleted behind one meta-rule), unsafe_code = "deny" makes "NEVER use unsafe" a compile error, the Sui-pin rule gets a CI script, and the git rules get a PreToolUse hook.
  • AGENTS.mdCLAUDE.md symlink per the agents.md cross-tool standard.

dev-docs/ contents

dev-docs/
├── README.md                     index + the CLAUDE.md-vs-dev-docs contract
├── specs/                        relocated unchanged (git mv; same maintenance rule)
├── playbooks/
│   ├── ci-suites.md              dispatchable suite workflows, runner facts, artifact recovery
│   ├── mpc-stall-postmortem.md   the check-ordered diagnosis from the wedge investigations
│   └── localnet.md               local Sui+ika localnet: version traps, readiness, fresh-ids trap
├── conventions/
│   ├── sui-version-bump.md       every pin location + the bump procedure
│   └── simtest.md                moved from CLAUDE.md + run commands
├── learnings/
│   └── pitfalls.md               failure CLASSES with the general rule each taught
├── plans/                        multi-PR implementation plans, explicit status lifecycle
│                                 (active → landed/superseded/abandoned); behavior moves to
│                                 specs/ on landing; code comments never reference plan phases
└── reviews/                      long-form PR/design/audit reviews — point-in-time records
                                  with per-finding RESOLUTION tracking, not maintained truth

CLAUDE.md changes

  • Karpathy's four working principles added (think before coding / simplicity first / surgical changes / goal-driven execution) — the compact form of the viral four rules.
  • Six clippy-enforced style rules deleted behind one meta-rule: mechanically-enforceable rules go in clippy.toml/lints, not here. Near-duplicate lines merged.
  • New: minimal-verification-by-change-type map; compaction-preservation instruction for long sessions; the multi-location Sui-pin gotcha (mainnet-v* or testnet-v* — bump everywhere in one PR).
  • Net: 297 → ~250 lines with strictly more load-bearing content.

Enforcement

  • scripts/check-sui-version-consistency.sh (wired into the CI Format job): the single root-Cargo.toml Sui tag is the source of truth; the TS workflows' binary-download URLs, CLAUDE.md, and any wasm-workspace pins must match exactly, flavor included.
  • Cargo.toml: unsafe_code = "deny" workspace lint (workspace verified zero-unsafe; full CI build green).
  • .claude/hooks/git-guard.sh (PreToolUse[Bash], wired in the checked-in settings.json): blocks-and-explains --no-verify, pushes targeting dev/main/master, commits made while ON a protected branch, and commits of .rs files with a dirty rustfmt check. Flags are scanned on a heredoc-cut, quote-stripped view of the command so commit messages mentioning them can't false-positive — a class found when the hook blocked its own introduction commit, which also verified its liveness end-to-end. Validated against 9 scenarios.

Team-shared .claude/

.gitignore now ships agents/, hooks/, skills/, and settings.json (personal settings.local.json/worktrees stay ignored; personal skills belong in ~/.claude/skills/):

  • Skills: /dispatch-suites (fire the three heavy suites, triage by failure shape), /stall-postmortem (the ordered MPC-stall diagnosis as a command), /bump-sui (the full bump checklist, manual-invoke only).
  • Subagent: consensus-reviewer — six review lenses encoding the invariants real wedges taught: consensus determinism, epoch-close lock gating, batch-loop continues, no silent skips, parameter-set agreement, liveness symmetry.

Notes for reviewers

🤖 Generated with Claude Code

…stency

Reorganize engineering documentation per current agentic-coding best
practice (Anthropic's Claude Code guidance: CLAUDE.md is loaded every
session, so it carries only always-applicable rules — "for each line,
ask: would removing this cause mistakes?"; bloat makes rules get lost.
Karpathy's context-engineering framing: agent-legible docs, copy-
pasteable commands, specs as the lever, knowledge compiled into a
persistent markdown base):

- dev-docs/ — the on-demand knowledge base (docs/ stays the website):
  - specs/ relocated here unchanged (same maintenance rule, now
    covering the whole folder);
  - playbooks/: ci-suites (dispatchable workflows, runner facts,
    artifact recovery), mpc-stall-postmortem (the check-ordered
    diagnosis distilled from the wedge investigations), localnet
    (version traps, readiness gates, fresh-ids trap);
  - conventions/: sui-version-bump (every pin location + procedure),
    simtest (moved from CLAUDE.md verbatim + run commands);
  - learnings/pitfalls.md: failure CLASSES with the general rule each
    taught (consensus determinism, batch-loop returns, silent skips,
    eager backtraces, port races, poll-budget hierarchy, ...).
- CLAUDE.md slimmed 297 → 211 lines: the CI-suites and simtest deep
  dives moved out behind one-line pointers (plain paths, not @imports —
  imports inline into every session); specs section updated; new gotcha:
  the Sui version (mainnet-v* or testnet-v*) is pinned in multiple
  places and must be bumped everywhere in one PR.
- AGENTS.md → CLAUDE.md symlink (the cross-tool agent-instructions
  standard; nearest-file-wins, supported by Codex/Cursor/Jules/Aider).
- scripts/check-sui-version-consistency.sh wired into the CI fmt job:
  the single root-Cargo.toml Sui tag is the source of truth; the TS
  workflows' binary downloads, CLAUDE.md, and any wasm-workspace pins
  must match exactly (flavor included) or CI fails.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…repo skills and reviewer agent

Second pass over CLAUDE.md per the same best-practice sources as the
dev-docs reorg, this time converting advisory rules into enforcement
and adding the pieces that load on demand instead of every session:

- CLAUDE.md: add Karpathy's four working principles (think before
  coding, simplicity first, surgical changes, goal-driven execution);
  delete the six style rules clippy.toml already enforces (unbounded
  channels, block_on, deserialize_from, log macros, arg limit,
  struct-init shorthand) behind one meta-rule — mechanically-enforceable
  rules go in clippy.toml/lints, not here; merge near-duplicate lines;
  add a minimal-verification-by-change-type map and a compaction
  preservation instruction for long sessions.
- Cargo.toml: `unsafe_code = "deny"` workspace lint — "NEVER use
  unsafe" as a compile error, not a request (workspace has zero unsafe).
- .claude/ partially un-gitignored: project settings, subagents, hooks
  dir, and skills now ship with the repo (settings.local.json and
  worktrees stay personal; personal skills belong in ~/.claude/skills).
- New repo skills: /dispatch-suites (fire the three heavy CI suites and
  triage by failure shape), /stall-postmortem (the ordered MPC-stall
  diagnosis as a command), /bump-sui (the full bump checklist).
- New subagent: consensus-reviewer — six review lenses encoding the
  invariants real wedges taught (consensus determinism, epoch-close
  lock gating, batch-loop continues, no silent skips, parameter-set
  agreement, liveness symmetry).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@omersadika

Copy link
Copy Markdown
Contributor Author

Second commit (d8f039e5b3) extends the same best-practice pass from advisory to enforced:

  • Karpathy's four working principles added to CLAUDE.md (think before coding / simplicity first / surgical changes / goal-driven execution) — the compact form of the viral four rules.
  • Enforce, don't document: the six style rules clippy.toml already catches are deleted behind one meta-rule ("mechanically-enforceable rules go in clippy.toml/lints, not here"), and unsafe_code = "deny" lands as a workspace lint — "NEVER use unsafe" is now a compile error.
  • On-demand pieces instead of per-session prose: three repo skills (/dispatch-suites, /stall-postmortem, /bump-sui) and a consensus-reviewer subagent encoding the six invariant lenses the wedge investigations taught. .claude/ is now selectively checked in (project settings, agents, skills; personal files stay ignored).
  • Plus: minimal-verification-by-change-type map and a compaction-preservation instruction for long sessions.

omersadika and others added 4 commits June 13, 2026 00:03
…rules

PreToolUse[Bash] hook blocking (with an explanation, never modifying
anything): any git command carrying the --no-verify flag, pushes
targeting dev/main/master (word-boundary match — branch names merely
containing those words pass), commits made while ON a protected branch,
and commits including .rs files while the workspace rustfmt check is
dirty.

Flags and push targets are scanned on a reduced view of the command —
cut at the first heredoc marker, quoted spans stripped — so a commit
MESSAGE that mentions --no-verify or a protected-branch name cannot
trip the guard (the unfixed version blocked its own introduction
commit, which is also how the hook's liveness got verified end-to-end).

Validated against 9 scenarios including refspec-form pushes,
dev-substring branch names, and quoted/heredoc false-positive cases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- plans/: implementation plans that outlive a session or span PRs, with
  an explicit status lifecycle (active/landed/superseded/abandoned);
  intent lives here, durable behavior moves to specs/ on landing, and
  code comments never reference plan phases.
- reviews/: long-form PR/design/audit reviews as point-in-time records
  with per-finding resolution tracking; recurring findings get
  distilled into learnings/pitfalls.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
#4)

The v4 pipeline's three designed halt/block modes are safety-first by
design, so a blocked validator looks healthy from outside. The metrics
all exist (verified against the registries); what was missing is the
alerting contract: rules for ika_handoff_prepare_waiting (barrier
blocked > 2x epoch) and off_chain_assembly_wedged (EverythingExcluded —
the one mode with no self-heal), the log-based signal for the joiner
bootstrap fail-closed halt, the operator action for each, and the
secondary dashboard signals (pruner advancement, presign-queue drain,
rejected handoff signatures).

Also merges origin/dev (PRs #1734/#1735): git's rename detection carried
the new adoption-guards section of specs/handoff.md into the relocated
dev-docs/specs/handoff.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- ci-suites.md: test-cluster.yaml's test_filter is a nextest positional
  filter — it matches test FUNCTION names, not file stems (a file-stem
  filter silently runs 0 tests and fails with "no tests to run").
- pitfalls.md: an IkaNodeHandle holds a strong Arc<IkaNode>; holding one
  across its node's in-process restart keeps the RocksDB stores open and
  the respawn dies on "lock hold by current process". Acquire handles on
  demand, never across stop()/start().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@omersadika omersadika merged commit 65a7073 into dev Jun 13, 2026
10 checks passed
@omersadika omersadika deleted the chore/dev-docs-and-claude-md branch June 13, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant