Answers the 3 adoption questions (Plan-21 follow-up):
1) LEVEL SELECTION (4 packaging levels, packaging/levels.json):
- install.sh --level core|devkit; platform refused (preview service),
enterprise refused (future). Level recorded in .casan-level.
- casan init --level 1..4: L1=gate+Plan-20 hooks only; L2=+CI+domain-pack;
L3=L2 base+preview note; L4=refused. New `casan level show|set`.
- levels.json core now includes adapters/ + schemas/ + install scripts.
2) EXISTING SHELLS (agents/skills): init MERGES Plan-20 hooks into an existing
.claude/settings.json and .codex/{hooks.json,config.toml} idempotently
instead of clobbering — preserves the project's own hooks/agents/skills and
unrelated keys. Re-running never duplicates the CASAN hook.
3) NO RE-INDEX / NO SHELL REWRITE: init only adds config; it does not parse or
index code and does not rewrite the project shell.
Safety fixes after a test accidentally ran init in the real repo:
- launcher shim now SELF-LOCATES its install from its own path (no ambient
CASAN_HOME cross-talk).
- casan init REFUSES to adopt a CASAN source hub into itself (--force to
override), so the Plan-20 hooks can't block the developing agent.
- test always runs init inside throwaway dirs; +source-hub guard test.
hybrid-install-tests.sh: 41/41 PASS.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CASAN DevKit (Level 2 — Adoption Kit)
Everything a new project needs to adopt the CASAN governance harness in a repeatable way. Level 2 = Level 1 core harness + adoption tooling.
Contents
| Path | Purpose |
|---|---|
install.sh |
Install core harness + bin/casan into a target repo, scaffold a domain, register it |
project-scaffold.py |
Create an idempotent production NestJS/React monorepo shell with manifest, CI, Docker and harness |
Dockerfile.harness |
Minimal image to run the gate on any mounted repo (casan gate) |
templates/domain-pack/ |
Per-project domain scaffold (input / golden-runs / corpus / domain-pack.yaml) |
templates/gitea-workflow/ci.yml |
Reusable Gitea Actions gate workflow |
templates/project-shell/nestjs-react/ |
Buildable/tested production project shell |
schemas/project-manifest.schema.json |
Versioned multi-project execution contract |
quality-profiles/enterprise-web-v1.json |
Shared quality floor and command allowlist |
Create a new production shell
packages/casan-devkit/install.sh \
--target ../my-project \
--project ticketing \
--domain "Ticketing" \
--template nestjs-react
cd ../my-project
npm install
bin/casan project validate --manifest apps/ticketing/domain/project.manifest.json
bin/casan pipeline --manifest apps/ticketing/domain/project.manifest.json --dry-run
npm test && npm run build
The operation is fail-closed and idempotent: identical files are retained; a different existing file aborts the run and is never overwritten. No generated command is passed through a shell.
Quick adopt
# from a CASAN source hub or an extracted casan-devkit bundle
packages/casan-devkit/install.sh --target ../my-project --project ticketing --domain "Ticketing"
cd ../my-project
# add requirement + golden baseline under apps/ticketing/domain/, then:
CASAN_DOMAIN_ROOT=apps/ticketing/domain bin/casan gate
bin/casan reuse # HARNESS_REUSE_VALID
Guides
docs/packaging/ADOPTION_GUIDE.md— end-to-end adoptiondocs/packaging/DOMAIN_PACK_GUIDE.md— how to fill a domain packdocs/packaging/CI_GUIDE.md— wire the gate into Gitea CIdocs/packaging/DOCKER_GUIDE.md— run/build the harness image
Adoption of an existing repository is config + domain only. New repositories can additionally use the production project-shell template. In both modes, adopters never edit gate logic (H1→H7).