An in-code, AI-native annotation system + multi-language toolchain: markers like
@spec/@rule/@linklive right on the code, distilled by per-language tools into a machine-readable asset for AI to consume. It is the shared source-of-truth for spec/case assets bound to code, used white-box by case-code-review (ccr) and black-box by test/eval/perf harnesses. | 中文: README.zh-CN.md
A spec states the intent/contract of a code symbol. A CaseSet case is a reusable black-box stimulus plus per-face judgment criteria; spec.json carries the smaller white-box checklist projection attached to a symbol. spec-case's distinct contribution is the stable code↔spec/case binding — the symbol-id — shared by those assets. That binding supports two consumer paths:
- A harness runs black-box cases (
case → verdict). ccrattaches the white-box projection to a changed review unit as a per-function checklist.
A review unit is the review-side twin of a case: same "requirement/contract" asset, two consumers.
Think of spec-case markers as structured comments bound to code symbols — more precisely, structured intent annotations. They preserve the reasoning that cannot be recovered reliably from the implementation alone, while keeping it addressable and machine-readable:
specrecords what the code is intended to guarantee and why the contract exists.rulerecords what a future change or review must keep in mind.linkpoints to the design context or related symbol that explains the intent.caseadds a concrete validation scenario when one is worth preserving; it is optional.
Their primary purpose is not to replace unit or e2e tests. Tests and harnesses prove behavior;
markers preserve the intent behind that behavior. Unlike free-form comments, markers use a stable
vocabulary, bind to a symbol-id, compile into spec.json, and can be checked for drift with
specgen --check.
docs/—concepts.md,glossary.mdspec/— normative schemas, the symbol-id contract, and per-language marker grammarsconformance/— shared behavior fixtures every language toolchain must passtoolchains/python/— the pip package: markers,specgen, and the optional canonical Case modeltoolchains/go/— the Gospecgenimplementationtoolchains/typescript/— TypeScript decorators, JSDoc markers, and the Compiler APIspecgen
pip install spec-case # markers + specgen only, zero deps
pip install 'spec-case[model]' # + canonical Case model (pydantic, pyyaml)
npm install @compforge/spec-case # TypeScript markers + specgenEarly WIP. The case model and vocabulary are standard test/eval terms; the symbol-id binding is the new piece this project owns.