Skip to content

Contributing to AgentSpec

Get the repository compiling and all tests passing, then follow the conventions below.

Prerequisites

  • Node.js ≥ 20
  • pnpm ≥ 9 (npm i -g pnpm)

Setup

bash
git clone https://github.com/agents-oss/agentspec.git
cd agentspec
pnpm install
pnpm build
pnpm test        # all tests must pass before you start

Scripts

Root (runs across all packages)

CommandWhat it does
pnpm buildBuild all packages (sdkadapter-claudecli, sidecar)
pnpm testRun all unit/integration tests
pnpm lintTypeScript type-check all packages
pnpm typecheckTypeScript type-check all packages (alias of lint)
pnpm cleanRemove all dist/ artefacts
pnpm schema:exportRe-generate schemas/v1/agent.schema.json from Zod schema

Make shortcuts

bash
make install      # pnpm install
make build        # build all packages
make test         # run all tests
make lint         # type-check all packages
make typecheck    # same as lint
make clean        # remove build artefacts
make build-sdk    # build @agentspec/sdk only
make build-cli    # build @agentspec/cli only
make test-sdk     # test @agentspec/sdk only
make test-cli     # test @agentspec/cli only
make schema       # regenerate schemas/v1/agent.schema.json
make docs         # start VitePress dev server (hot-reload)
make docs-build   # build static doc site → docs/.vitepress/dist
make docs-preview # preview built site locally

Per-package

bash
pnpm --filter @agentspec/sdk          test
pnpm --filter @agentspec/cli          test
pnpm --filter @agentspec/adapter-claude test
pnpm --filter @agentspec/sidecar      test

# Sidecar — unit/integration + E2E (needs Docker)
pnpm --filter @agentspec/sidecar      test:e2e
pnpm --filter @agentspec/sidecar      test:all

# Watch mode (one package at a time)
pnpm --filter @agentspec/sdk dev

Environment Variables for Local Development

When running agentspec generate locally:

VariableRequiredDefaultPurpose
ANTHROPIC_API_KEYYes (for generate/helm)Claude API key
ANTHROPIC_MODELNoclaude-opus-4-6Override model
ANTHROPIC_BASE_URLNoAnthropic APICustom proxy endpoint

When running the sidecar locally (or in tests):

VariableRequiredDefaultPurpose
UPSTREAM_URLYeshttp://localhost:8000Agent's HTTP URL
MANIFEST_PATHNo/manifest/agent.yamlPath to agent.yaml inside container
PROXY_PORTNo4000Sidecar proxy listen port
CONTROL_PLANE_PORTNo4001Control plane listen port
ANTHROPIC_API_KEYNoRequired only for /gap LLM analysis
AUDIT_RING_SIZENo1000Number of audit ring entries to keep

Package Architecture

agentspec/
├── packages/
│   ├── sdk/              @agentspec/sdk        — manifest schema, health checks, audit rules
│   ├── adapter-claude/   @agentspec/adapter-claude — LLM code generation via Claude API
│   ├── cli/              @agentspec/cli        — agentspec CLI binary
│   └── sidecar/          @agentspec/sidecar    — Fastify proxy + control plane
├── docs/                 VitePress docs site
├── schemas/v1/           JSON Schema (generated, do not hand-edit)
└── Makefile              Top-level convenience targets

Build order matters: sdk must be built before adapter-claude and cli, because they depend on it as workspace packages.

Adapter Build Note

@agentspec/adapter-claude build script copies skill Markdown files to dist/skills/:

bash
tsup && mkdir -p dist/skills && cp src/skills/*.md dist/skills/

If you add a new skill file, ensure it ends in .md and is placed in src/skills/. It is auto-discovered by listFrameworks() at runtime.

Branch and Commit Conventions

Branch patternUse for
feat/<description>New features
fix/<description>Bug fixes
docs/<description>Documentation only
chore/<description>Tooling, deps, CI

Commits use Conventional Commits:

feat: add --deploy helm flag
fix: resolve $env: refs in model.check before probing
docs: update cli.md with --deploy usage
chore: bump @anthropic-ai/sdk to 0.40

PR Checklist

  • [ ] pnpm test — all tests pass
  • [ ] pnpm typecheck — zero type errors
  • [ ] New code has tests written first (TDD: RED → GREEN → REFACTOR)
  • [ ] Docs updated if a user-visible behaviour changed
  • [ ] pnpm schema:export run and schemas/v1/agent.schema.json committed if schema changed

See Also

Released under the Apache 2.0 License.