# zkcrypto-audit

A collection of agent skills for staged, evidence-driven audits of
zero-knowledge systems and cryptographic protocols. The skills follow the open
Agent Skills format and are packaged as plugins for Claude Code and Codex.

## Project Layout

- `plugins/<category>/skills/<skill>/` holds the skills. `SKILL.md` is the
  source of truth for a skill's behaviour; `references/`, `workflows/`, and
  `templates/` hold what it reads on demand.
- `plugins/core-audit-flow/skills/crypto-audit-router/` holds the staged flow
  (`workflows/full-audit-flow.md`), the routing policy
  (`references/routing-matrix.md`), the state machine, and the session-state
  schema and template.
- `plugins/core-audit-flow/skills/audit-dashboard/` holds the local read-only
  dashboard: `scripts/serve.py`, the event recorder `scripts/record.py`, and
  the static page under `assets/`.
- `plugins/core-audit-flow/hooks/hooks.json` declares the Claude Code hooks
  that run the event recorder.
- `plugins/evidence-and-tooling/skills/zkbugs-index/` carries the zkbugs data
  plane inside the skill: the pre-built `index/`, plus `scripts/` and
  `config/`.
- `.claude-plugin/marketplace.json` is the Claude Code marketplace and the
  source of truth for plugin names, descriptions, and the version.
- `scripts/sync.py` regenerates derived packaging and validates the repository.
- `examples/engagements/` holds sample engagement directories.

Generated by `scripts/sync.py`; never edit by hand:

- `plugins/*/.claude-plugin/plugin.json` and `plugins/*/.codex-plugin/plugin.json`
- `.agents/plugins/marketplace.json` (Codex marketplace)
- `plugins/*/skills/*/agents/openai.yaml` (Codex skill metadata)
- the skill count in the `README.md` badge

## Changing Skills

1. Edit the canonical files under `plugins/<category>/skills/<skill>/`.
2. Keep each skill self-contained: files a skill tells an agent to read must
   live inside that skill's directory and be referenced by a path relative to
   it. Refer to other skills by name, never by path.
3. Use only Agent Skills spec frontmatter (`name`, `description`, `license`,
   `compatibility`, `metadata`, `allowed-tools`), with `allowed-tools` as a
   space-separated string. Keep wording agent-neutral.
4. A new or renamed skill needs a row in the routing matrix.
5. Run `python3 scripts/sync.py`, then `python3 scripts/sync.py --check`
   (needs `pip install -r scripts/requirements.txt`). CI runs the check.

To change the version, edit `metadata.version` in
`.claude-plugin/marketplace.json`, add the `CHANGELOG.md` entry, and run the
sync.

## Running an Audit

Start every audit with the `crypto-audit-router` skill and read its
`workflows/full-audit-flow.md` completely before selecting any auditor. That
file defines phase order, workspace layout, session state, skip rules, and the
completion contract.

Order:

1. `crypto-audit-router`
2. `crypto-audit-context`
3. `spec-delta-checker`, unless no specification or documentation governs the
   code
4. Every domain auditor the routing matrix matches
5. `crypto-fp-check` on every candidate
6. `crypto-report-writer`
7. Closeout

If a step or a matched route is skipped, say so and give the reason.

Audit working state goes in `.zkcrypto-audit/<engagement-id>/` (`session.json`,
`reports/`, `pocs/`) in the directory the audit is run from. It is ignored by
git in this repository.
