Organize CASAN as a reusable source hub with SPLIT releases so downstream adopts only the level it needs (packaging/levels.json is the single source of truth). Implemented now: - Level 1 Core: bin/casan CLI (run/gate/test/verify/reuse/dashboard) + VERSION. - Level 2 DevKit: packages/casan-devkit (install.sh, Dockerfile.harness, templates: project scaffold, domain-pack, gitea-workflow). - scripts/package-release.sh core|devkit|platform|all-in-one-demo — builds split bundles into dist/ (BUNDLE-MANIFEST + SHA256SUMS); platform is stamped PREVIEW/INCOMPLETE; enterprise (future) is REFUSED (exit 3, no fake-complete package). Bundles verified: extract → bin/casan works, deterministic + domain suites pass, casan reuse VALID. - docs/packaging: CASAN_PACKAGING_PLAN + ADOPTION + CI + DOMAIN_PACK + GITEA_PACKAGE + DOCKER. Structure + docs only: - Level 3 packages/casan-platform (dashboard exists; control-panel/viewers pending). - Level 4 packages/casan-enterprise (RBAC/tenant/KMS/WORM/approval exist in core; governed console pending). No Chat Console/RBAC-console/tenant-console/model-mgmt built in this task. Harness change (enables extracted bundles to self-resolve): casan-paths.sh + the Python project_root() walk-ups now accept a second root marker `packages/casan-harness` in addition to `.specify`, so a freshly-unpacked core/devkit/demo bundle (no `.specify` yet) roots correctly and creates state on first run. In an adopted repo `.specify` still matches first. policy-bundle.yaml paths corrected to packages/casan-harness (re-signed). Full gate 64/0/3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
2.7 KiB
Markdown
53 lines
2.7 KiB
Markdown
# CASAN Domain Pack Guide
|
|
|
|
A **Domain Pack** is the per-project data the harness needs to govern YOUR domain. It lives
|
|
at `apps/<project>/domain/` and is selected via `CASAN_DOMAIN_ROOT`. The harness code
|
|
(`packages/casan-harness/`) never contains domain data — this is what makes it reusable.
|
|
|
|
Scaffold template: `packages/casan-devkit/templates/domain-pack/`.
|
|
|
|
## Layout
|
|
```
|
|
apps/<project>/domain/
|
|
├── domain-pack.yaml # manifest describing this pack
|
|
├── input/
|
|
│ ├── requirement.md # FR-xx table drives the traceability gate
|
|
│ └── architecture.md # optional tech-stack/context
|
|
├── golden-runs/
|
|
│ └── <artifact>.golden.txt # baseline for drift detection (H7)
|
|
├── corpus/
|
|
│ ├── redteam-corpus.jsonl # attack vectors (H4 recall) — one JSON per line
|
|
│ ├── redteam-vectors.jsonl # vectors for benign-fp-report / redteam metrics
|
|
│ └── benign-corpus/*.txt # benign samples (H4 false-positive budget)
|
|
└── traceability-map.json # FR-xx → code files + test files (+ optional symbols/lines)
|
|
```
|
|
|
|
## Each piece
|
|
- **input/requirement.md** — must contain a `| FR-xx | ... |` table. The traceability gate
|
|
(Plan-10) requires every `FR-xx` to map to ≥1 existing code file and ≥1 test file. No
|
|
secrets/PII (the H4 input scan blocks them).
|
|
- **golden-runs/** — a canonical "good" artifact per pipeline output. `drift-detect` compares
|
|
a run against it; similarity 1.0 = no drift. Real drift detection is proven separately.
|
|
- **corpus/** — red-team attack vectors (scored for H4 recall) + a benign corpus (bounds the
|
|
false-positive rate). Domain-specific injections make the H4 score meaningful.
|
|
- **traceability-map.json** — `{"FR-01": {"name": "...", "code": ["backend/src/...", {"file":"...","symbols":["Foo"],"lines":[12]}], "tests": ["..."]}}`. Symbol/line refs are
|
|
optional but tighten the gate.
|
|
- **domain-pack.yaml** — documents the above + optional threshold overrides.
|
|
|
|
## Wire it up
|
|
```bash
|
|
export CASAN_DOMAIN_ROOT=apps/<project>/domain
|
|
bin/casan gate # runs domain-dependent suites against your pack
|
|
```
|
|
`domain_root` is also recorded per-project in `packages/casan-harness/level5/project-registry.json`
|
|
so `bin/casan reuse` can prove multi-project reuse.
|
|
|
|
## Reference example
|
|
The OKR app's own pack is the worked example: `apps/okr/domain/` (golden-runs, corpus,
|
|
input, traceability-map). Copy its shape for your domain.
|
|
|
|
## Toward Plan-12 (Domain Pack SDK)
|
|
Today a pack is a directory + `CASAN_DOMAIN_ROOT`. Plan-12 will make it fully declarative
|
|
(register a pack by manifest, no manual wiring). The `domain-pack.yaml` here is the seed of
|
|
that manifest.
|