Contributing to Amber Protocol
September 3, 2026 · View on GitHub
Thank you for your interest in contributing to Amber Protocol!
Getting Started
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/amber-protocol.git - Install dependencies:
npm install - Run tests:
npm test - Make your changes
- Submit a pull request
Development Workflow
Running Tests
# Run all tests
npm test
# Run specific test suite
npm run test:unit
npm run test:integration
npm run test:load
# Run web viewer tests
cd apps/web
npm test
npm run test:e2e
# Run validation
npm run manifests
npm run doctor
Code Style
- Use CommonJS modules (
require/module.exports) for CLI scripts - Use ES modules for web viewer code
- Follow existing naming conventions (kebab-case for files, camelCase for functions)
- Keep functions under 50 lines where possible
- Write tests for new features
- Document command-line interfaces
- Compile every JSON Schema through
scripts/lib/core/schema-contract.js; never instantiate Ajv elsewhere (tests/unit/schema-contract-guard.test.jsenforces it)
Git Commit Identity
This repository requires a single author/committer identity on new commits:
- name:
Bandersnatch0x - email:
xihalele@gmail.com(or the GitHub noreply form13325067+bandersnatch0x@users.noreply.github.com)
Local setup:
git config --local user.name "Bandersnatch0x"
git config --local user.email "xihalele@gmail.com"
npm run dev:hooks:install # points core.hooksPath at .githooks (pre-commit identity check)
npm run identity:check # validate the effective author/committer now
CI runs the same checker on introduced commits (identity job). Release jobs and the test matrix wait on it.
Platform exceptions (CI only): when validating already-made commits (--range / --commit), the checker accepts exact name+email pairs for Dependabot, GitHub’s bot committer, and github-actions[bot]. It also accepts GitHub's account display name as the author when the commit uses this repository's exact noreply email and was committed by the exact GitHub bot identity — covering GitHub-generated merge AND squash-merge commits (squash-merges carry a single parent; the trust anchor is the owner's noreply address plus GitHub's own committer identity, which only holds when the owner produced the commit through GitHub). Local pre-commit (npm run identity:check with no args) stays human-only so platform or bot identities cannot land from a workstation.
CLI:
npm run identity:check
node scripts/validate-git-identity.js --range <base>..<head>
node scripts/validate-git-identity.js --commit <sha> # exactly one revision (git log -1)
Commit Messages
Use conventional commit format:
<type>: <description>
<optional body>
Types: feat, fix, refactor, docs, test, chore, perf, ci
Example:
feat: add session pause command
Allow users to pause a running session for later continuation.
Updates session state machine and adds pause event to timeline.
Architecture Documentation
Before making significant changes, review the architecture documentation:
These documents provide design context and help maintain architectural consistency.
Tracing Git History
The repository underwent a major rename from "Coding Harness" to "Amber Protocol" in June 2026. Historical context and design decisions are preserved in Git history.
Finding Historical Documentation
Historical planning documents and phase notes (formerly tracked under docs/legacy/plans/) now live in the internal archive and remain retrievable from Git history:
# List historical plan files and the commits that touched them
git log --all --oneline -- "docs/legacy/plans/"
# Read a specific historical plan from history
git show <commit>:docs/legacy/plans/2026-06-10-phase-c-web-viewer.md
Current implementation plans are tracked under docs/plans/.
Tracing File History
Use git log --follow to trace files through renames:
# Trace main CLI through rename
git log --follow scripts/amber.js
# Trace core facade through rename
git log --follow scripts/lib/amber-core.js
# Trace wiki template through rename
git log --follow templates/docs/wiki/agent/amber.md
Finding Design Decisions
Architecture decisions and rationale are recorded in:
- Git commit messages - Use
git log --grep="<keyword>"to find relevant commits - Planning documents - See
docs/plans/for implementation plans (older phase notes live in Git history underdocs/legacy/plans/) - Architecture docs - See
docs/architecture/for extracted design documentation - CLAUDE.md - Project overview and current architecture
Example searches:
# Find commits related to session lifecycle
git log --grep="session" --oneline
# Find route engine implementation
git log --grep="route" --since="2026-06-01" --until="2026-06-15"
# Find governance implementation
git log --grep="governance" --oneline
Testing Requirements
All changes must:
- Pass existing tests:
npm test - Include new tests for new features
- Pass manifest validation:
npm run manifests - Pass doctor check:
npm run doctor - Not break web viewer:
cd apps/web && npm test
Documentation Requirements
When adding new commands or features:
- Update
README.mdwith command examples - Add help text to CLI (see existing
usage()functions) - Update
CLAUDE.mdif changing core architecture - Add architecture documentation for significant new components
Pull Request Process
- Create a feature branch:
git checkout -b feat/my-feature - Make your changes with clear commit messages
- Run all tests and validation
- Push to your fork
- Create a pull request with:
- Clear description of changes
- Rationale for the change
- Test coverage summary
- Any breaking changes noted
Design Principles
When contributing, keep these principles in mind:
- Governance-first: Strengthen verification, observability, and control surfaces
- Read-only by default: Commands should read state unless explicitly modifying
- Idempotent operations: Commands should be safe to run multiple times
- No hidden state: All state should be in
.amber/directory - Repository-local: Avoid dependencies on external services
- Conservative execution: Don't run Dynamic Workflows or auto-rewrite project files
Getting Help
- Open an issue for bugs or feature requests
- Check existing issues before opening new ones
- Tag issues appropriately (bug, enhancement, question, documentation)
- Be respectful and constructive in discussions
Release Process
Quality Documentation
Before releasing, review the quality assurance documentation:
- Core Use Cases - Essential functionality validation
- Coverage Baseline - Test coverage requirements
- Release Checklist - Pre-release verification steps
- Rollback Procedures - Emergency rollback guide
Automated Release (Default)
Amber Protocol uses automated releases via GitHub Actions. When a stable version tag (vX.Y.Z) is pushed, CI runs the full test matrix and publishes both amber-protocol and dsh-amber-protocol to npmjs.org from .github/workflows/ci.yml. The GitHub Packages workflow remains a scoped mirror of the main package only.
Core invariants (never bypass):
npm run version:syncMUST be executed during prep (it keeps plugin manifests,dsh/package.json, and the root lockfile in lockstep withpackage.json).npm run release:verifyMUST be run after the tag is pushed and the publish workflow has completed (terminal guard against the v1.3.1 ghost-version class from #46).- Prefer the smallest increment (patch) unless the changes warrant minor/major.
Zero-dependency changelog automation:
CHANGELOG.md is now generated from conventional commits by node scripts/changelog.js (pure Node + git, modeled on sync-version.js / verify-release.js). No external release-please or additional dependencies. This fulfills #47: the next release cut requires no hand-written CHANGELOG.
Release cut workflow:
- Ensure working tree clean and on
master. All changes landed as conventional commits (feat:,fix:,chore:, etc.). - Choose minimal bump and update
package.json:npm version --no-git-tag-version patch # or minor / major - Sync plugin manifests, DSH bundle version, and lockfile (mandatory):
npm run version:sync - Generate the release section in CHANGELOG.md from commits since the prior tag:
Review the insertednpm run changelog## [X.Y.Z] - YYYY-MM-DDsection. Light narrative polish is acceptable; the commit list is authoritative. - Stage and commit (version files + changelog):
git add package.json package-lock.json dsh/package.json .claude-plugin/plugin.json .codex-plugin/plugin.json CHANGELOG.md git commit -m "chore(release): vX.Y.Z" - Create annotated tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z" - Push:
git push origin master git push origin vX.Y.Z - CI runs tests, then publishes
amber-protocolanddsh-amber-protocolto npmjs (idempotent; re-runs are safe). - After the publish workflow succeeds, run the terminal verifier:
This asserts every stable tag is on the remote and both lockstep packages exist on npmjs.npm run release:verify
Version Tag Format:
- Stable releases:
v1.0.0,v1.1.0,v2.0.0(triggers npmjs lockstep publish) - Release candidates:
v1.0.0-rc.1,v1.0.0-rc.2(skips npmjs publish) - Beta releases:
v1.0.0-beta,v1.0.0-beta.1(skips npmjs publish)
Publish workflow notes:
- Authoritative npmjs flow: the
releasejob in.github/workflows/ci.yml. It validates the lockstep version contract, publishesamber-protocol, thendsh-amber-protocol, then creates the GitHub Release. Both publish steps skip if that exact version already exists. - Mirror:
.github/workflows/publish-github-packages.yml(on tag pushv*, scopes temporarily for@bandersnatch0x/amber-protocol, publishes idempotently tohttps://npm.pkg.github.com). It does not publish the DSH bundle.
Manual Release (Emergency Fallback)
If automated release fails or is unavailable, use manual publish. Follow the invariants above (version:sync + changelog generator + release:verify).
# 1. Ensure all checks pass
npm test
npm run manifests
npm run doctor
# 2. Validate package contents
npm pack --dry-run
# 3. (If needed) Publish to GitHub Packages manually (rare)
# npm pkg set name="@bandersnatch0x/amber-protocol"
# echo "@bandersnatch0x:registry=https://npm.pkg.github.com" >> .npmrc
# echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc
# npm publish --registry=https://npm.pkg.github.com
# npm pkg set name="amber-protocol"
# 4. Create GitHub Release manually (body should reference the generated CHANGELOG)
gh release create vX.Y.Z \
--title "Release vX.Y.Z" \
--notes "See [CHANGELOG.md](https://github.com/Bandersnatch0x/amber-protocol/blob/master/CHANGELOG.md)" \
--latest
Version Numbering Rules
Amber Protocol follows Semantic Versioning:
- MAJOR (v2.0.0): Breaking changes to CLI interface or route schema
- MINOR (v1.1.0): New features, new commands, backward-compatible changes
- PATCH (v1.0.1): Bug fixes, documentation updates, no new features
Pre-release Tags
For testing releases before stable publish (these do not trigger the GitHub Packages publish):
# Prepare RC (use generator for changelog even for RCs)
npm version 1.1.0-rc.1 --no-git-tag-version
npm run version:sync
npm run changelog
git add package.json .claude-plugin/plugin.json .codex-plugin/plugin.json CHANGELOG.md
git commit -m "chore(release): v1.1.0-rc.1"
git tag -a v1.1.0-rc.1 -m "Release Candidate 1"
git push origin master v1.1.0-rc.1
# Beta example follows identical pattern (no publish triggered)
Install pre-releases with: npm install -g amber-protocol@rc or npm install -g amber-protocol@beta (from GitHub Packages).
GitHub Secrets / Permissions
The authoritative npmjs release job in .github/workflows/ci.yml uses secrets.NPM_TOKEN to publish amber-protocol and dsh-amber-protocol.
The GitHub Packages publish workflow (.github/workflows/publish-github-packages.yml) uses the built-in GITHUB_TOKEN (with packages: write permission). It is a scoped mirror of the main package only, does not publish the DSH bundle, and skips -rc/-beta tags while still allowing workflow_dispatch.
License
By contributing, you agree that your contributions will be licensed under the MIT License.