Skip to content

Add agent bootstrap hook and consolidate instructions into AGENTS.md#373

Open
kraenhansen wants to merge 5 commits into
mainfrom
claude/worker-repo-setup-oswgnr
Open

Add agent bootstrap hook and consolidate instructions into AGENTS.md#373
kraenhansen wants to merge 5 commits into
mainfrom
claude/worker-repo-setup-oswgnr

Conversation

@kraenhansen

Copy link
Copy Markdown
Collaborator

Summary

Sets this repo up so AI coding agents (Claude Code on the web in particular) can install and bootstrap a fresh worker automatically, and consolidates the tool-agnostic instructions under the general AGENTS.md convention.

Changes

Worker bootstrap

  • .claude/hooks/session-start.sh — a SessionStart hook that selects Node.js 24 via nvm (required by package.json's devEngines; workers default to Node 22, which npm rejects), then runs npm install and npm run build. It's remote-only (guarded by $CLAUDE_CODE_REMOTE), idempotent, non-interactive, and persists the Node 24 toolchain onto PATH via $CLAUDE_ENV_FILE.
  • .claude/settings.json — registers the hook.

Instructions consolidation

  • AGENTS.md (new, top-level) — canonical, tool-agnostic agent instructions. Carries the former Copilot content plus a new "Environment & Bootstrap" section (Node 24 requirement, install/build steps, and why native iOS/Android builds are intentionally excluded — they need the Android NDK / Apple toolchains absent on a generic Linux worker).
  • .github/copilot-instructions.md — slimmed to a redirect at AGENTS.md, keeping the conventional Copilot path working with a single source of truth.
  • packages/cmake-file-api/copilot-instructions.mdpackages/cmake-file-api/AGENTS.md — package-level instructions renamed to the same convention (agents pick up nested AGENTS.md files).
  • CLAUDE.md (new) — thin file that imports @AGENTS.md and documents the web SessionStart hook.

Design notes

  • Where there was a choice between a Claude-specific and a general mechanism, the general one was preferred: shared guidance lives in AGENTS.md, the bootstrap is a plain shell script, and CLAUDE.md only holds what's genuinely Claude-web-specific.
  • Native mobile builds are deliberately not in the default bootstrap; the docs point at the explicit-target commands (e.g. npx ferric --apple) for when the right SDK is available.

Validation

  • Hook run against a simulated fresh worker (Node 22 on PATH first): installs Node 24.18.0 / npm 11.16.0, installs deps, builds cleanly (exit 0). Non-remote guard verified as a clean no-op.
  • eslint runs clean on the Node tooling packages under Node 24.
  • npm test --workspace gyp-to-cmake passes (20/20).

After merging into the default branch, all future Claude Code web sessions on this repo will use the hook.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NvxEaPhyEq2HCZ6XFjEAde


Generated by Claude Code

claude and others added 5 commits July 17, 2026 19:00
Add a SessionStart hook and settings so Claude Code on the web workers
install and build the repo automatically, plus a CLAUDE.md that points at
the existing shared instructions and documents environment specifics.

- .claude/hooks/session-start.sh: selects Node 24 via nvm (required by
  devEngines), runs npm install and npm run build; remote-only and idempotent
- .claude/settings.json: registers the SessionStart hook
- CLAUDE.md: imports .github/copilot-instructions.md and documents bootstrap,
  common commands, and that native iOS/Android builds need mobile SDKs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvxEaPhyEq2HCZ6XFjEAde
Promote the tool-agnostic instructions to a top-level AGENTS.md (the general
cross-agent standard) and add environment/bootstrap notes. CLAUDE.md now
imports AGENTS.md, and .github/copilot-instructions.md redirects to it so the
content has a single source of truth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvxEaPhyEq2HCZ6XFjEAde
Agents pick up nested AGENTS.md files in subdirectories, so align the
package-level instructions with the same convention as the root.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvxEaPhyEq2HCZ6XFjEAde
Add a .nvmrc set to lts/krypton (matching CI's setup-node) and have the
SessionStart hook run `nvm install`/`nvm use` without a version argument so
the pinned version is the single source of truth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvxEaPhyEq2HCZ6XFjEAde
CI resolved Rust dependencies fresh on every run because Cargo.lock was
gitignored (a leftover from the initial `cargo new --lib` scaffolding in
#43 — the stock library-crate convention). That let `napi-derive-backend`
float to 5.1.2, which expands the `#[napi]` attribute macro into a broken
`ctor` `unify_features` invocation ("expected `(`, found `]`"), failing the
bootstrap build of every CI job that compiles ferric-example.

ferric-example is a `crate-type = ["cdylib"]` that builds a final `.node`
artifact, not a library published to crates.io, so committing Cargo.lock is
the recommended practice — the direct analogue of package-lock.json. The
committed lock pins napi-derive-backend 5.0.2 (last known-good). Verified
with `cargo build --locked`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 050464b)
@kraenhansen kraenhansen self-assigned this Jul 17, 2026
@kraenhansen kraenhansen added the CI Continuous integration label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants